Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This structure defines the attributes of a font.
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;
Members
Value | Description |
---|---|
> 0 | The font mapper transforms this value into device units and matches it against the cell height of the available fonts. |
0 | The font mapper uses a default height value when it searches for a match. |
< 0 | The font mapper transforms this value into device units and matches its absolute value against the character height of the available fonts. |
For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size.
This mapping occurs when the font is used for the first time.
For the MM_TEXT mapping mode, you can use the following formula to specify a height for a font with a given point size.
lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
The lfEscapementmember specifies both the escapement and orientation. You should set lfEscapementand lfOrientationto the same value.
The following values are defined for convenience.
Value | Weight |
---|---|
FW_DONTCARE | 0 |
FW_THIN | 100 |
FW_EXTRALIGHT | 200 |
FW_ULTRALIGHT | 200 |
FW_LIGHT | 300 |
FW_NORMAL | 400 |
FW_REGULAR | 400 |
FW_MEDIUM | 500 |
FW_SEMIBOLD | 600 |
FW_DEMIBOLD | 600 |
FW_BOLD | 700 |
FW_EXTRABOLD | 800 |
FW_ULTRABOLD | 800 |
FW_HEAVY | 900 |
FW_BLACK | 900 |
ANSI_CHARSET | BALTIC_CHARSET |
CHINESEBIG5_CHARSET | DEFAULT_CHARSET |
EASTEUROPE_CHARSET | GB2312_CHARSET |
GREEK_CHARSET | HANGUL_CHARSET |
MAC_CHARSET | OEM_CHARSET |
RUSSIAN_CHARSET | SHIFTJIS_CHARSET |
SYMBOL_CHARSET | TURKISH_CHARSET |
Korean Windows:
JOHAB_CHARSET |
Middle-Eastern Windows:
HEBREW_CHARSET |
ARABIC_CHARSET |
Thai Windows:
THAI_CHARSET |
The OEM_CHARSET value specifies a character set that is operating-system dependent.
You can use the DEFAULT_CHARSET value to allow the name and size of a font to fully describe the logical font. If the specified font name does not exist, a font from any character set can be substituted for the specified font, so you should use DEFAULT_CHARSET sparingly to avoid unexpected results.
Fonts with other character sets may exist in the operating system. If an application uses a font with an unknown character set, it should not attempt to translate or interpret strings that are rendered with that font.
This member is important in the font mapping process. To ensure consistent results, specify a specific character set. If you specify a typeface name in the lfFaceNamemember, make sure that the lfCharSetvalue matches the character set of the typeface specified in lfFaceName .
Value | Description |
---|---|
OUT_DEFAULT_PRECIS | Specifies the default font mapper behavior. |
OUT_RASTER_PRECIS | Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name. |
OUT_STRING_PRECIS | This value is not used by the font mapper, but it is returned when raster fonts are enumerated. |
Value | Description |
---|---|
CLIP_DEFAULT_PRECIS | Specifies default clipping behavior. |
CLIP_CHARACTER_PRECIS | Not used. |
CLIP_STROKE_PRECIS | Not used by the font mapper, but is returned when raster, vector, or TrueType fonts are enumerated. |
Value | Description |
---|---|
CLEARTYPE_COMPAT_QUALITY | Enables ClearType text for the font using compatible widths. A compatible width produces text that has the same spacing as non-ClearType text. |
CLEARTYPE_QUALITY | Enables ClearType text for the font. |
DEFAULT_QUALITY | Appearance of the font does not matter. |
DRAFT_QUALITY | Appearance of the font is less important than when PROOF_QUALITY is used. For GDI raster fonts, scaling is enabled, which means that more font sizes are available, but the quality may be lower. Bold, italic, underline, and strikeout fonts are synthesized if necessary. |
PROOF_QUALITY | Character quality of the font is more important than exact matching of the logical-font attributes. For GDI raster fonts, scaling is disabled and the font closest in size is chosen. Although the chosen font size may not be mapped exactly when PROOF_QUALITY is used, the quality of the font is high and there is no distortion of appearance. Bold, italic, underline, and strikeout fonts are synthesized if necessary. |
Bits 4 through 7 of the member specify the font family and can be one of the following values:
The proper value can be obtained by using the Boolean OR operator to join one pitch constant with one family constant.
Font families describe the look of a font in a general way. They are intended for specifying fonts when the exact typeface desired is not available. The values for font families are as follows.
Value | Description |
---|---|
FF_DECORATIVE | Novelty fonts, for example, Old English. |
FF_DONTCARE | Don't care or don't know. |
FF_MODERN | Fonts with constant stroke width (monospace), with or without serifs. Monospace fonts are usually modern, for example, Pica, Elite, and Courier New. |
FF_ROMAN | Fonts with variable stroke width (proportional) and with serifs, for example, Serif. |
FF_SCRIPT | Fonts designed to look like handwriting, for example, Script and Cursive. |
FF_SWISS | Fonts with variable stroke width (proportional) and without serifs, for example, Sans Serif. |
Remarks
Windows CE versions 1.0 and 1.01 do not support the following values for lfClipPrecision:
Windows CE versions 1.0 and 1.01 do not support the PROOF_QUALITY value for the lfQualitymember.
Windows CE versions 2.0 and later ignore the lfClipPrecisionand lfQualitymembers with one important exception. If the raster font engine is installed, a IfClipPrecisionvalue of CLIP_CHARACTER_PRECIS will cause functions that create and select fonts to fail.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Wingdi.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
CreateFontIndirect, EnumFontFamilies