fontinfo(
fontinfo(
FONT
,
SIZE
,
STYLE
)

The fontinfo( function returns a dictionary with information about a specified font.

Parameters

This function has three parameters:

font – name of the font.

size – size of the font (in points). The size does not have to be an integer value.

style – the style of the font, for example bold, italic or bolditalic. For a plain style leave this parameter blank or omit it entirely.

Description

This function returns a dictionary with information about a specified font. The dictionary contains information like the ascender and descender height, leading, etc. This example determines the height of capital letters for 12 point Helevetica text.

    getdictionaryvalue(fontinfo("Helvetica",12),"CAPHEIGHT") ☞ 8.607422

Some fonts allow modifiers on the name:

    getdictionaryvalue(fontinfo("Optima ExtraBlack",24),"WEIGHT") ☞ 11

Use the dumpdictionary( function to see a list of all of the available attributes.

    dumpdictionary(catcherror("",fontinfo("Courier",24,"italic")))

Here is a typical result of this formula:

    LEADING=0.000000
    CAPHEIGHT=14.273438
    DESCENDER=-5.906250
    FIXEDPITCH=-1
    DISPLAYNAME=Courier Oblique
    XHEIGHT=11.097656
    ASCENDER=18.093750
    POINTSIZE=24.000000
    MAXWIDTH=19.757812
    GLYPHCOUNT=1343
    FAMILY=Courier
    WEIGHT=5

See Also

- fontcharacters( -- returns a string (text) containing all of the characters supported by the specified font.
- fontinformation -- accesses information about a font (see also the fontinfo( function).
- measuretext( -- returns the size of a string of text in a particular font and size.

History

Version | Status | Notes
10.0 | New | New in this version.