The information in this article applies to:
SUMMARY
The following article is a detailed explanation of using the EnumFontFamiliesEx function. It also serves as an update to the article "Retrieving Font Styles Using EnumFontFamilies." MORE INFORMATION
The EnumFontFamiliesEx function is similar to the older EnumFontFamilies function. Following is the prototype for EnumFontFamiliesEx:
The lpLogfont points to the LOGFONT structure, which has the information about the fonts for enumeration. The LOGFONT structure:
The lfCharSet parameter specifies the character set. The following values are defined:
If the lfCharSet parameter is set to DEFAULT_CHARSET, the function will enumerate every font in the system as many times as there are Windows character sets supported in this font.
For example, the Arial font shipping with the Windows 2000 operating system supports the following nine character sets:
This means that the callback function is called nine times for the Arial font, where on each callback the fields LOGFONT.lfCharSet and TEXTMETRICS.tmCharSet are set to a different charset value from the above set of supported character sets in the Arial font.
If the lfCharSet value on input is set to a value different than DEFAULT_CHARSET, then only those fonts in the system that support this character set will be enumerated. For example, if lfCharSet is set to RUSSIAN_CHARSET, then the Arial font from the above example enumerates and the callback function calls for Arial only once. If lfCharSet value is set to JOHAB_CHARSET on input, the Arial font is not enumerated at all. The parameter lfFaceName is a null-terminated string that specifies the typeface name of the font. Its length must not exceed 32 characters, including the null terminator. If this is set to an empty string, then the function enumerates one font in each available typeface name.
The lpelfe parameter points to an ENUMLOGFONTEX structure that contains information about the logical attributes of the font. The lpntme parameter also points to a structure that contains information about the physical attributes of a font. Set this to NEWTEXTMETRICEX for TrueType fonts, or TEXTMETRICEX for other fonts. The callback function is called once for each font name of the TrueType font specified by the lfFaceName in the LOGFONT structure. In addition, it gets multiplicatively called for each script supported by that font. Thus, the callback is made for num_of_font_names X num_of_scripts. However, for non-TrueType fonts, the callback function is called once for each face size supported by that font. The number of face sizes supported by each font differs from those supported by another font, and also varies from machine to machine. For example, if MS Sans Serif supports face sizes 8, 10, 12, 14, 18 and 24 on a particular machine, then the callback function is called 6 times (for the above 6 different face sizes). Although, this is not the case for TrueType fonts since these fonts are continuously scalable and if the callback were done for each size of the TrueType font, then there would be an infinite number of callbacks.
Additional query words: EnumFontFamilies EnumFontFamiliesEx LOGFONT EnumFontFamExProc
Keywords : kbDDK kbFont kbGDI kbNTOS400 kbPrinting kbTTFonts |
Last Reviewed: May 19, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |