TEXTMETRIC

typedef struct tagTEXTMETRIC {

short tmHeight;

short tmAscent;

short tmDescent;

short tmInternalLeading;

short tmExternalLeading;

short tmAveCharWidth;

short tmMaxCharWidth;

short tmWeight;

BYTE tmItalic;

BYTE tmUnderlined;

BYTE tmStruckOut;

BYTE tmFirstChar;

BYTE tmLastChar;

BYTE tmDefaultChar;

BYTE tmBreakChar;

BYTE tmPitchAndFamily;

BYTE tmCharSet;

short tmOverhang;

short tmDigitizedAspectX;

short tmDigitizedAspectY;

} TEXTMETRIC;

The TEXTMETRIC structure contains a list of the basic metrics of a physical font.

Members

tmHeight

Specifies the height of the character cell. This member is equal to the sum of the tmAscent and tmDescent members.

tmAscent

Specifies the ascent of the character cell, that is, height of the cell measured from the baseline.

tmDescent

Specifies the descent of the character cell, that is, the height of the cell measured from the baseline to the bottom of the cell.

tmInternalLeading

Specifies the amount of internal leading. It is equal to the difference between the cell height (as expressed by the tmHeight member) and the maximum height of any character in the font (excluding the height of accent marks).

tmExternalLeading

Specifies the recommended amount of leading for the font.

tmAveCharWidth

Specifies the average width of characters in the font (loosely defined as the width of the letter “X”).

tmMaxCharWidth

Specifies the maximum width of any character in the font.

tmWeight

Specifies the weight of the font.

tmItalic

If nonzero, specifies an italic font.

tmUnderlined

If nonzero, specifies an underlined font.

tmStruckOut

If nonzero, specifies a font that has been struck through.

tmFirstChar

Specifies the value of the first character defined in the font.

tmLastChar

Specifies the value of the last character defined in the font.

tmDefaultChar

Specifies the value of the character that is to be substituted for characters that are not in the font.

tmBreakChar

Specifies the value of the character that is to be used to define word breaks for text justification.

tmPitchAndFamily

Specifies the font pitch and font family. This member is a combination of one pitch and one family value. The pitch value can be any one of the following values.

Value Meaning

DEFAULT_PITCH (0x00) Chooses a reasonable font.
FIXED_PITCH (0x01) Chooses a fixed-pitch font.
VARIABLE_PITCH (0x02) Chooses a variable-pitch font.

The font family, which describes in a general way the look of a font, can be any one of the following values.

Value Meaning

FF_DONTCARE (0x00) Chooses a reasonable font.
FF_ROMAN (0x10) Chooses a variable-pitch font with serifs.
FF_SWISS (0x20) Chooses a variable-pitch fonts without serifs.
FF_MODERN (0x30) Chooses a fixed-pitch font.
FF_SCRIPT (0x40) Chooses a cursive or script font.
FF_DECORATIVE (0x50) Chooses a novelty font.

tmCharSet

Specifies the character set of the font. It can be one of the following values.

Value Meaning

ANSI_CHARSET (0x00) Indicates the ANSI character set.
SYMBOL_CHARSET (0x02) Indicates the Symbol character set.
OEM_CHARSET (0xFF) Indicates an OEM-specific character set. The characters and corresponding character codes depend on the computer.

tmOverhang

Specifies the amount of additional, synthesized width of a character or character string. This member may be is nonzero if the driver synthesizes character attributes, such as bold or italic, by modifying an existing font.

tmDigitizedAspectX

Specifies the horizontal aspect ratio for which this font was designed. This member is equal to the dfHorizRes member of the FONTINFO structure.

tmDigitizedAspectY

Specifies the vertical aspect ratio for which this font was designed. This member is equal to the dfVertRes member of the FONTINFO structure.

Comments

GDI makes a string bold by expanding the intracharacter spacing and overstriking with an offset; the overhang is the distance by which the overstrike is offset. GDI italicizes a font by skewing the string, and the overhang is the amount the top of the font is skewed past the bottom of the font.

See Also

EnumDFonts