int CALLBACK EnumFontsProc(lplf, lpntm, FontType, lpData) | |||||
LOGFONT FAR* lplf; | /* address of logical-font data structure | */ | |||
NEWTEXTMETRIC FAR* lpntm; | /* address of physical-font data structure | */ | |||
int FontType; | /* type of font, */ | ||||
LPARAM lpData; | /* address of application-defined data | */ |
The EnumFontsProc function is an application-defined callback function that processes font data from the EnumFonts function.
lplf
Points to a LOGFONT structure that contains information about the logical attributes of the font. The LOGFONT structure has the following form:
typedef struct tagLOGFONT { /* lf */
int lfHeight;
int lfWidth;
int lfEscapement;
int lfOrientation;
int lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
BYTE lfFaceName[LF_FACESIZE];
} LOGFONT;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
lpntm
Points to a NEWTEXTMETRIC structure that contains information about the physical attributes of the font, if the font is a TrueType font. If the font is not a TrueType font, this parameter points to a TEXTMETRIC structure.
The NEWTEXTMETRIC structure has the following form:
typedef struct tagNEWTEXTMETRIC { /* ntm */
int tmHeight;
int tmAscent;
int tmDescent;
int tmInternalLeading;
int tmExternalLeading;
int tmAveCharWidth;
int tmMaxCharWidth;
int tmWeight;
BYTE tmItalic;
BYTE tmUnderlined;
BYTE tmStruckOut;
BYTE tmFirstChar;
BYTE tmLastChar;
BYTE tmDefaultChar;
BYTE tmBreakChar;
BYTE tmPitchAndFamily;
BYTE tmCharSet;
int tmOverhang;
int tmDigitizedAspectX;
int tmDigitizedAspectY;
DWORD ntmFlags;
UINT ntmSizeEM;
UINT ntmCellHeight;
UINT ntmAvgWidth;
} NEWTEXTMETRIC;
The TEXTMETRIC structure is identical to NEWTEXTMETRIC except that it does not include the last four members. For a full description of these structures, see the Microsoft Windows Programmer's Reference, Volume 3.
FontType
Specifies the type of the font. This parameter can be a combination of the following masks:
DEVICE_FONTTYPE RASTER_FONTTYPE TRUETYPE_FONTTYPE
lpData
Points to the application-defined data passed by the EnumFonts function.
This function must return a nonzero value to continue enumeration; to stop enumeration, it must return zero.
An application must register this callback function by passing its address to the EnumFonts function. The EnumFontsProc function is a placeholder for the application-defined function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition (.DEF) file.
The AND (&) operator can be used with the RASTER_FONTTYPE, DEVICE_FONTTYPE, and TRUETYPE_FONTTYPE constants to determine the font type. If the RASTER_FONTTYPE bit is set, the font is a raster font. If the TRUETYPE_FONTTYPE bit is set, the font is a TrueType font. If neither bit is set, the font is a vector font. A third mask, DEVICE_FONTTYPE, is set when a device (for example, a laser printer) supports downloading TrueType fonts; it is zero if the device is a display adapter, dot-matrix printer, or other raster device. An application can also use the DEVICE_FONTTYPE mask to distinguish GDI-supplied raster fonts from device-supplied fonts. GDI can simulate bold, italic, underline, and strikeout attributes for GDI-supplied raster fonts, but not for device-supplied fonts.