FONTMETRIC( ) Function

Returns font attributes for the current installed operating system fonts.

FONTMETRIC(nAttribute [, cFontName, nFontSize [, cFontStyle]])

Return Values

Numeric

Parameters

  • nAttribute
    Determines the font attribute FONTMETRIC( ) returns. If you omit cFontName, nFontSize, and cFontStyle, FONTMETRIC( ) returns the attribute for the current font in the active output window.

    The following table lists values for nAttribute and the corresponding font attributes returned.

    NAttribute Attribute
    1 Character height in pixels
    2 Character ascent (units above baseline) in pixels
    3 Character descent (units below baseline) in pixels
    4 Leading (space between lines) in pixels
    5 Extra leading in pixels
    6 Average character width in pixels
    7 Maximum character width in pixels
    8 Font weight.
    9 Italic (0 = no, nonzero = yes)
    10 Underlined (0 = no, nonzero = yes)
    11 Strikeout (0 = no, nonzero = yes)
    12 First character defined in font
    13 Last character defined in font
    14 Default character (substituted for characters not in font)
    15 Word-break character
    16 Pitch and family
    17 Character set
    18 Overhang (extra added width)
    19 Horizontal aspect for font device
    20 Vertical aspect for font device

    For more information about the numeric values returned by FONTMETRIC( ), see the TEXTMETRIC function in the Microsoft Windows Programmer's Reference.

  • cFontName
    Specifies the name of an installed font.

  • nFontSize
    Specifies the point size of the font specified with cFontName.

  • cFontStyle
    Specifies a font style code for the font specified with cFontName. If you omit cFontStyle, FONTMETRIC( ) returns the attribute for the Normal font style.

    cFontStyle can be a character or a combination of characters listed in the following font style table. For example, the combination BI specifies the Bold Italic font style.

    Character Font style
    B Bold
    I Italic
    N Normal
    O Outline
    Q Opaque
    S Shadow
    Strikeout
    T Transparent
    U Underline

Remarks

FONTMETRIC( ) returns font attributes for the current font for the active output window. WFONT( ) can be used to determine the current window font.

See Also

AFONT( ) | Fonts Overview | GETFONT( ) | SYSMETRIC( ) | TXTWIDTH( ) | WFONT( )