text_metrics


Metrics of a true type font.

template<class character>
struct text_metrics
{
    int height;
    int ascent;
    int descent;
    int internal_leading;
    int external_leading;
    int average_character_width;
    int maximum_character_width;
    int weight;
    int over_hang;
    int aspect_x;
    int aspect_y;
    character first_character;
    character last_character;
    character default_character;
    character break_character;
    byte italic;
    byte underline;
    byte strikeout;
    byte pitch_and_family;
    byte character_set;
};

height The height of characters (ascent + descent).
ascent The ascent of characters (units above the base line).
descent The descent of characters (units below the base line).
internal_leading The amount of leading space inside the bounds set by the member height. Accent marks and other diacritic characters may occur in this area. The font designer may set this member to zero.
external_leading The amount of extra leading space that the is added between rows. This area is outside the font and it contains no marks and is not altered by text output calls. The font designer may set this member to zero.
average_character_width The average width of characters in the font (usually defined as the width of the letter x). The value does not include the overhang required for bold or italic characters.
maximum_character_width The width of the widest character in the font.
weight The weight of the font.
overhang This member may be used to determine how much of the character width returned by a call to the function get_text_extent is the actual character width and how much is the overhang. The actual width is the extent minus the overhang.
aspect_x The horizontal aspect of the device for which the font was designed.
aspect_y The vertical aspect of the device for which the font was designed. The ratio of the members AspectX and AspectY is the aspect ratio of the device.
first_character The codepoint of the first character defined in the font.
last_character The codepoint of the last character defined in the font.
default_character The codepoint of the character to be substituted for characters not in the font.
break_character The codepoint of the character that is used to define word breaks for text justification.
italic Non-zero if the font is italic.
underline Non-zero if the font is underlined.
strikeout Non-zero if the font is overstruck.
pitch_and_family Information about the pitch, technology and family of a physical font.

The four low-order bits of this member specify information about the pitch and the technology of the font - see enumeration pitch_and_family.

true_type and postscript fonts set the bit pitch_and_family::vector. A monospace bitmap font has all of the low-order bits clear. A proportional bitmap font sets the bit pitch_and_family::Variable. A postscript printer device font sets the bit pitch_and_family::device.

The four high-order bits of this member designate the family of the font. The value 0xf0 and the bitwise and operator may be used to mask out the four low-order bits. The value obtained is this way can be directly compared with font family names.

For information about font families, see the class logical_font.

character_set The character set of the font - see enumeration font_characters.