Using Fonts
In Windows CE, fonts are grouped into families that share common stroke width characteristics. Fonts within a family are distinguished by size and style. The following table shows the font families.
Font family name | Description |
---|---|
Decorative | Specifies a novelty font such as Old English. |
Dontcare | Specifies a generic family name. This name is used when information about a font does not exist or does not matter. |
Modern | Specifies a monospace font with or without serifs. Monospace fonts are usually modern such as Pica, Elite, and Courier New. |
Roman | Specifies a proportional font with serifs such as Times New Roman. |
Script | Specifies a font designed to look like handwriting such as Script and Cursive. |
Swiss | Specifies a proportional font without serifs such as Arial. |
These family names correspond to constants found in the Wingdi.h header file: FF_DECORATIVE, FF_DONTCARE, FF_MODERN, FF_ROMAN, FF_SCRIPT, and FF_SWISS. Use these constants to create, select, or retrieve font information.
For information about how fonts are represented and stored, see Working with TrueType and Raster Fonts.
Enabling Font Linking
Windows CE provides font linking capability, making it possible to link one or more fonts, called linked fonts, to another font, called the base font. Once you link fonts, you can use the base font to display code points that do not exist in the base font, but do exist in one of the linked fonts. For example, linking a Hangeul font and a Japanese font to a Latin font gives you the ability to display both Korean and Japanese characters in the Latin font using the Unicode text API.
Note Font linking can only add glyphs to a base font; you cannot override or replace glyphs in the base font.
If font linking is enabled on your device, you can examine the registry by enumerating the subkeys of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\FontLink\SystemLink to determine the mappings of linked fonts to base fonts. You can add additional links by creating additional subkeys. The following code shows how to add an additional link.
base font face name = path and file to link to, face name of the font to link
Creating End User Defined Characters
Although Windows CE defines thousands of characters, you can define your own set of characters. Use an end user defined character (EUDC) when you need to define a character or glyph for a device. Always associate an EUDC with a double-byte character set (DBCS) and a TrueType font. When you create an EUDC, choose a reserved DCBS value. Applications use DBCS values to identify the EUDC. Windows CE uses DBCS values to locate the shape and style information in the corresponding TrueType font. The shape and style information specifies how to draw the EUDC.
To create an EUDC
- Choose a character value in the specified range or ranges of reserved characters.
- Use an EUDC editor to create the shape and style of the character.
- Add the shape and style information to the TrueType font in the entry that corresponds to the selected character value.
To associate an EUDC font with another font
Copy the EUDC font to a folder.
The EUDC font has a .tte extension.
Call EnableEUDC (FALSE).
Modify the HKEY_CURRENT_USER\EUDC registry key.
Create a subkey under HKEY_CURRENT_USER\EUDC.
In the subkey that you created in step 4, enter the font path that contains the EUDCs.
For example, type the following code in the subkey to link the Tahoma font with the test03.tte font located in the Windows directory.
Tahoma=\windows\test03.tte
Call EnableEUDC (TRUE).
Note Before creating EUDC entries in the registry, enumerate the existing EUDC settings to ensure that you do not overwrite entries defined for the Windows CE–based device.
Working with Fonts
Your platform can contain a number of fonts. To learn how to determine what fonts are available on your system, see Enumerating Fonts. For information about loading a font from a resource file, see Installing and Using Fonts.
Windows CE provides six standard logical fonts. You can use the GetStockObject function to obtain a standard font. The following table shows the standard font values.
Value | Description |
---|---|
ANSI_FIXED_FONT | Specifies a monospace font based on the Windows character set, usually represented by a Courier font. |
ANSI_VAR_FONT | Specifies a proportional font based on the Windows character set, usually represented by the MS Sans Serif font. |
DEVICE_DEFAULT_FONT | Specifies the preferred font for the specified device, usually represented by the System font for display devices. |
OEM_FIXED_FONT | Specifies a monospace font based on an OEM character set. |
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. |
See Also
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.