INFO: Complete Enumeration of System Fonts

ID: Q99672

3.10 4.00 | 3.50 3.51 WINDOWS | WINDOWS NT kbgraphic EnumFonts
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) 3.1
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT, versions 3.5, 3.51, 4.0
    • Microsoft Windows 95


SUMMARY

Complete enumeration of system fonts is a two-phase process. Applications should first call EnumFontfamilies with NULL as the family name to enumerate all the font face names in the system. Applications should then take each face name and call EnumFontFamilies again to obtain the style names (for TrueType fonts only) or the supported point sizes (for raster fonts only). The style names are not supported for the raster and vector fonts. Because TrueType and vector fonts are continuously scalable, their point sizes are not enumerated.


MORE INFORMATION

The following steps detail the enumeration:

  1. Call EnumFontFamilies with NULL as the family name (lpszFamily) to list one font from each available font family.


  2. In the EnumFontFamProc callback function, look at the nFontType parameter.


  3. If nFontType has the TRUETYPE_FONTTYPE flag set, then call EnumFontFamilies with the family name set to the font's type face name (lfFaceName of the ENUMLOGFONT structure). The callback function is called once for each style name. This enumeration is useful if the application is interested in finding a TrueType font with a specific style name (such as "Outline"). Because a TrueType font is continuously scalable, it is not necessary to enumerate a given font for point sizes. An application may use any desired point size. If the application is listing the enumerated TrueType fonts, it can simply choose some representative point sizes in a given range. The point sizes recommended by "The Windows Interface: An Application Design Guide" (page 159, Section 8.4.1.4) are 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, and 72. All TrueType fonts are available on both displays and printers, so an application can be sure that the font appears the same on the display and the printer.


  4. If nFontType has the RASTER_FONTTYPE flag set, then call EnumFontFamilies with the family name set to the font's type face name. The callback function is called once for each available point size. Raster fonts can be scaled only in multiples of the available point sizes. Because scaled raster fonts are usually not appealing to the user, applications may choose to limit themselves to the available sizes. Because Microsoft Windows version 3.1 does not define style names for raster fonts, there is no need to enumerate for style names.

    If the nFontType also has the DEVICE_FONTTYPE flag set, then the current font is a raster font available to the printer driver for use with the printer. The printer may have these fonts in hardware or be capable of downloading them when necessary. Applications that use such fonts should be aware that similar raster fonts may not be available on the display device. The converse is also true. If the DEVICE_FONTTYPE flag is not set, then applications should be aware that a similar font may not be available on the printer. Fonts generated by font packages such as Adobe Type Manager (ATM) are listed as device fonts.


  5. If nFontType has neither the TRUETYPE_FONTTYPE nor the RASTER_FONTTYPE flags set, then the enumerated font is a vector font. Vector fonts are also continuously scalable so they do not have to be enumerated for point sizes. Because Windows 3.1 does not support style names for vector fonts, there is no need to enumerate them for style names. Vector fonts are generally used by devices such as plotters that cannot support raster fonts. These fonts generally have a poor appearance on raster devices, so many applications avoid them.


Additional query words: 3.10 4.00

Keywords : kbNTOS350 kbNTOS351 kbNTOS400 kbWinOS95 kbSDKWin16
Version : WINDOWS:3.1,95; winnt:3.5,3.51,4.0
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: June 24, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.