INFO: Retrieve Font Styles Using EnumFontFamiliesExID: Q200111
|
BETA INFORMATION BETA INFORMATION BETA INFORMATION |
This article discusses a Beta release of a Microsoft product. The
information in this article is provided as-is and is subject to change
without notice. |
BETA INFORMATION BETA INFORMATION BETA INFORMATION |
The EnumFontFamiliesEx function is similar to the older EnumFontFamilies function. Following is the prototype for EnumFontFamiliesEx:
Int EnumFontFamiliesEx (
HDC hdc, // handle to device context
LPLOGFONT lpLogfont, // pointer to LOGFONT struct
FONTENUMPROC lpEnumFontFamExProc, // pointer to callback function
LPARAM lParam, // application-supplied data
DWORD dWFlags // reserved = 0
);
typedef struct tagLOGFONT {
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
TCHAR lfFaceName [LF_FACESIZE];
} LOGFONT;
ANSI_CHARSET
ARABIC_CHARSET
BALTIC_CHARSET
CHINESEBIG5_CHARSET
DEFAULT_CHARSET
EASTEUROPE_CHARSET
GB2312_CHARSET
GREEK_CHARSET
HANGUEL_CHARSET
HANGUL_CHARSET
HEBREW_CHARSET
JOHAB_CHARSET
MAC_CHARSET
OEM_CHARSET
RUSSIAN_CHARSET
SHIFTJIS_CHARSET
SYMBOL_CHARSET
THAI_CHARSET
TURKISH_CHARSET
VIETNAMESE_CHARSET
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.
ANSI_CHARSET
HEBREW_CHARSET
ARABIC_CHARSET
GREEK_CHARSET
TURKISH_CHARSET
VIETNAMESE_CHARSET
BALTIC_CHARSET
EASTEUROPE_CHARSET
RUSSIAN_CHARSET
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.
int CALLBACK EnumFontFamExProc (
ENUMLOGFONTEX *lpelfe,
NEWTEXTMETRICEX *lpntme,
int FontType,
LPARAM lParam
);
// Sample Test piece of code:
#include <Windows.H>
#include <StdIO.H>
#include <ConIO.H>
int CALLBACK EnumFontFamiliesExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam )
{
printf( "%s\n", lpelfe->elfFullName );
return 1;
}
int main( int __argc, char** __argv )
{
HDC hDC = GetDC( NULL );
LOGFONT lf = { 0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0,
0, "Courier New" };
EnumFontFamiliesEx( hDC, &lf, EnumFontFamiliesExProc, 0, 0 );
ReleaseDC( NULL, hDC );
return 0;
}
Additional query words: EnumFontFamilies EnumFontFamiliesEx LOGFONT EnumFontFamExProc
Keywords : kbDDK kbFont kbGDI kbNTOS400 kbPrinting kbTTFonts
Version : winnt:
Platform : winnt
Issue type : kbinfo
Last Reviewed: May 19, 1999