typedef struct { long lfHeight; long lfWidth; long lfEscapement; long lfOrientation; long lfWeight; GR_CHAR lfItalic; GR_CHAR lfUnderline; GR_CHAR lfStrikeOut; GR_CHAR lfCharSet; GR_CHAR lfOutPrecision; GR_CHAR lfClipPrecision; GR_CHAR lfQuality; GR_CHAR lfRoman; GR_CHAR lfSerif; GR_CHAR lfSansSerif; GR_CHAR lfModern; GR_CHAR lfMonospace; GR_CHAR lfProportional; GR_CHAR lfOblique; GR_CHAR lfSmallCaps; GR_CHAR lfPitch; char lfFaceName[MWLF_FACESIZE]; } GR_LOGFONT; |
A GR_LOGFONT structure is a logical font descriptor it is used to specify the desired font characteristics when creating a font. An application passes one of these structures into the GrCreateFont() function when a font is created.
Several macros are defined in mwtypes.h to help build the GR_LOGFONT structure. These macros are shown below.
Type | Name | Description |
---|---|---|
long | lfHeight | The font height in pixels. |
long | lfWidth | The font width in pixels. |
long | lfEscapement | The rotation of the font in tenths of a degree. |
long | lfOrientation | This field is not currently used. |
long | lfWeight | The font weight. See below |
GR_CHAR | lfItalic | GR_TRUE for an italic font, otherwise GR_FALSE. |
GR_CHAR | lfUnderline | GR_TRUE for an underlined font, otherwise GR_FALSE. |
GR_CHAR | lfStrikeOut | This field is currently not used. |
GR_CHAR | lfCharSet | The font character set. See below |
GR_CHAR | lfOutPrecision | Font type selection. See below |
GR_CHAR | lfClipPrecision | This field is currently not used. |
GR_CHAR | lfQuality | This field is currently not used. |
GR_CHAR | lfRoman | GR_TRUE for Roman (upright) letters, otherwise GR_FALSE. |
GR_CHAR | lfSerif | GR_TRUE for a serifed font, otherwise GR_FALSE. |
GR_CHAR | lfSansSerif | GR_TRUE for a sans-serif font, otherwise GR_FALSE. |
GR_CHAR | lfModern | GR_TRUE for a modern font, otherwise GR_FALSE. |
GR_CHAR | lfMonospace | GR_TRUE for a monsspaced font, otherwise GR_FALSE. |
GR_CHAR | lfProportional | GR_TRUE for a proportionally spaced, otherwise GR_FALSE. |
GR_CHAR | lfOblique | GR_TRUE for an oblique font, otherwise GR_FALSE. |
GR_CHAR | lfSmallCaps | GR_TRUE for a small caps font, otherwise GR_FALSE. |
GR_CHAR | lfPitch | The font pitch. See below |
char | lfFaceName[] | Zero terminated ASCII string containing the font face name. |
The following paragraphs list the enumeration values that may be used with the fields of the GR_LOGFONT structure.
Enumerations for the lfOutPrecision field.
Enumerations for the lfWeight field.
MWLF_WEIGHT_DEFAULT | MWLF_WEIGHT_MEDIUM |
MWLF_WEIGHT_THIN | MWLF_WEIGHT_DEMIBOLD |
MWLF_WEIGHT_EXTRALIGHT | MWLF_WEIGHT_BOLD |
MWLF_WEIGHT_LIGHT | MWLF_WEIGTH_EXTRABOLD |
MWLF_WEIGHT_NORMAL | MWLF_WEIGHT_BLACK |
MWLF_WEIGHT_REGULAR |
Enumerations for the lfCharSet field.
Enumerations for the lfPitch field.
MWLF_PITCH_DEFAULT | MWLF_PITCH_NORMAL |
MWLF_PITCH_ULTRACONDENSED | MWLF_PITCH_SEMIEXPANDED |
MWLF_PITCH_EXTRACONDENSED | MWLF_PITCH_EXPANDED |
MWLF_PITCH_CONDENSED | MWLF_PITCH_EXTRAEXPANDED |
MWLF_PITCH_SEMICONDENSED | MWLF_PITCH_ULTRAEXPANDED |
Built in font face names for the lfFaceName field.
The following macros set the
Table 3-1. GR_LOGFONT Macros
Name | Description |
---|---|
MWLF_Clear (GR_LOGFONT *lf) | This macro sets the size fields of the structure to zero, the weight to MWLF_WEIGHT_REGULAR, all of the flags to GR_FALSE and the face name to an empty string. |
MWLF_SetBold (GR_LOGFONT *lf) | This macro modifies the GR_LOGFONT so that it describes a bold font. The lfWeight is set to the constant value MWLF_WEIGHT_BOLD. |
MWLF_SetRegular (GR_LOGFONT *lf) | This macro modifies the GR_LOGFONT so that it describes a non-bold font. The lfWeight is set to the constant value MWLF_WEIGHT_REGULAR. |
MWLF_SetItalics (GR_LOGFONT *lf) | This macro modifies the GR_LOGFONT so that it describes an italic font. The lfItalic is set to GR_TRUE, the lfOblique is set to GR_FALSE and the lfRoman is set to GR_FALSE. |
MWLF_SetRoman (GR_LOGFONT *lf) | This macro modifies the GR_LOGFONT so that it describes a roman font. The lfItalic is set to GR_FALSE, the lfOblique is set to GR_FALSE and the lfRoman is set to GR_TRUE. |