Microsoft KB Archive/71226

INF: Font Mapper Weights Listed in the Windows SDK Reference ID Number: Q71226

3.00 3.10 WINDOWS

Summary:

The font penalty weights listed in the table on page 2-38 of the “Microsoft Windows Software Development Kit Reference–Volume 1” for Windows version 3.0 are not the actual weights used by the font mapper. This table documents the order of importance the font mapper assigns to various font attributes.

More Information:

The actual font penalty weights used by the graphics device interface (GDI) font mapper are not documented. They are subject to change as the font technology used by Windows is updated.

The table shows the order of importance assigned to various font attributes. However, the actual numbers assigned to attributes in the table are not useful. For example, according to the table, the penalty weight for CharSet is 4, Width is 2, Weight is 1, and Slant is 1. This does not mean that the penalty attributed to a font with an incorrect CharSet is equal to the penalty attributed to a font with incorrect Width, Weight, and Slant (2+1+1=4). CharSet is actually assigned a high penalty, whereas Width, Weight, and Slant are assigned low penalties. A font with the proper CharSet and the wrong Width, Weight, and Slant is selected before a font with the wrong CharSet and proper Width, Weight, and Slant.

To obtain the most control over the font that GDI provides, an application should use the EnumFonts function to enumerate the available fonts. An application is free to create its own penalty scheme to choose the most appropriate font. EnumFonts returns both a LOGFONT and a TEXTMETRIC data structure for each physical font enumerated. The application can obtain a handle to the selected font by passing the appropriate LOGFONT structure to the CreateFontIndirect function.

After GDI chooses a font, the application can call the GetTextMetrics function to retrieve information about the font. This provides a means to verify that the returned font has the desired characteristics.

Under Windows version 3.1, the basic font selection scheme remains the same. However, the introduction of TrueType font technology provides additional control over font selection. Because TrueType fonts are scalable, the height and width penalties for TrueType fonts are lower than for other font types. EnumFontFamilies is a font enumeration function introduces in Windows 3.1.

Additional reference words: 3.00 3.10 MICS3 R2.13