Tuesday, December 15, 2009

Enumerating Device Fonts from ppd file

The ppd file contains list of fonts resident in the printer. To list these fonts, we can use the EnumFontFamiliesEx function. Usually, EnumFontFamiliesEx will give the list of all the fonts in the system, and not those listed in ppd. It contains the TrueType fonts also. But to get an enumeration of fonts from the ppd file, use EnumFontFamiliesEx function, preceded by SetGraphicsMode( hDC, GM_ADVANCED).


HDC hDC = CreateDC( TEXT("WINSPOOL"), TEXT(""), NULL, NULL );

SetGraphicsMode(hDC, GM_ADVANCED);

EnumFontFamiliesEx(hDC, NULL, reinterpret_cast(&EnumFontsProc),
reinterpret_cast( &fontlist ), 0);

No comments:

Post a Comment