Installing Fonts (Windows Embedded CE 6.0)
1/6/2010
Call the AddFontResource function to load a font from a font resource file. When you finish using an installed font, call the RemoveFontResource function to remove the font. Whenever you add or delete a font resource, you should call the SendMessage function to send a WM_FONTCHANGE message to all applications in the system. This message notifies other applications that an application has modified the internal font table by adding or removing a font. You do not need to call AddFontResource to create or realize system fonts.
There are two stages to selecting a font. In the first stage, you specify the ideal font you would like to use. This theoretical font is called a logical font. In the second stage, an internal algorithm finds the physical font that is the closest match to your specified logical font. A physical font is a font stored on the device or in the operating system. This process is called font mapping.
To use a font, complete the following process:
Call the EnumFontFamilies function to build a list of the available fonts. This is especially useful when you want to determine available fonts from a specified font family or typeface.
Use the values returned by the font enumeration function to initialize the members of a LOGFONT structure.
Create the logical font by calling the CreateFontIndirect function and passing it a pointer to the initialized LOGFONT structure.
Select the logical font into the current device context with the SelectObject function.
When you call SelectObject, Windows Embedded CEābased devices load the physical font that most closely matches the logical font specified in the LOGFONT structure.
When initializing the members of the LOGFONT structure, be sure that the lfCharSet member specifies a particular character set. This member is used in the font mapping process and the results will be inconsistent if this member is not initialized correctly. If you specify a typeface name in the lfFaceName member of the LOGFONT structure, be sure that the lfCharSet member contains an appropriate value.
Windows Embedded CE keeps a table containing all the fonts available for application use. When you call CreateFontIndirect, Windows Embedded CE chooses a font from this table.
Windows Embedded CE provides a standard logical font. You can use the GetStockObject function to obtain the standard font. The following table shows the standard font value.
Value | Description |
---|---|
SYSTEM_FONT |
Specifies the System font. This is a proportional font based on the Windows character set and is used by the operating system to display window titles, menu names, and text in dialog boxes. The System font is always available. Other fonts are available only if installed. |