fontinfo

Displays information about a given font

Syntax:

fontinfo -f file [-S size] [-v] [-r] [-s dir]
                 [-t file] [-c ch] [-C ch]
                 [-u][<code|code-code> [...]]

Runs on:

Neutrino

Options:

-f file
The font file to display information about. This argument must be a path to the font file.
-S
An integer defining the font size of the rendered font. The default size is 10. This applies to scalable fonts only.
-v
Display more verbose information.
-r
Render each character to the screen using ASCII characters.
-s dir
A path to the directory of the font rendering engine.
-t file
The unicode file tab to display the name of each character. See note below.
-c ch
Render each character to the screen, using the supplied character to fill the white space around the character. This option uses an asterisk to render the font to the screen. The supplied character fills in the white space around the glyph.
-C ch
Render each character to the screen, using only the supplied character in the rendering. This option renders the character to the screen without using a character to fill up the white space.
-u
Display the UTF8 string as a string, instead of the default hex dump.
<code|code-code> [...]
Specifies the character code or code range to process or render. This command line option may be repeated.

Description:

The fontinfo utility returns information and metrics about each glyph in a given font file, or for a specified code list or range(s).

You can render each glyph in the font file to the screen (using ASCII characters) by using the -r option. You can render only a subset of glyphs in the font file by specifing a code range.


Note: The unicode tab file that is used by the -t argument must use the following format:
<Unicode hexcode>,<character description>
For example:
0021,EXCLAMATION MARK
0022,QUOTATION MARK
0023,NUMBER SIGN
0024,DOLLAR SIGN
0025,PERCENT SIGN
0026,AMPERSAND

You can obtain a unicode tab file from www.unicode.org.


Examples:

In the following example, the fontinfo utility is called using the font file webt.ttf. Each glyph in the file is rendered to the screen using the . character. The size of each glyph is 20 characters.

fontinfo -f web.ttf -r -C . -S 20

The output for a single glyph in the font file is shown below:

Range: 0x2030 (8240)
        0x2030 (8240, utf8:0xe2 0x80 0xb0, glyph index:16):
        Size: 26,22, render offset: 0,22
        Metrics: Adv.=001B.0000, BearingX,Y=0000.0000,0000.0540, maxX=0000.0680

          ...      ...
         .....     ..
        ... ...    ..
        ..   ..   ..
        ..   ..   ..
        ..   ..   ..
        ..   ..  ..
        ..   ..  ..
        ... ... ...
         .....  ..
          ...   ..  ....     ...
               ..  ......   .....
               .. ...  ... ... ...
               .. ..    .. ..   ..
              ..  ..    .. ..   ..
              ..  ..    .. ..   ..
             ...  ..    .. ..   ..
             ..   ..    .. ..   ..
             ..   ...  ... ... ...
            ..     ......   .....
            ..      ....     ...

In the following example, the fontinfo utility is called using the / character to fill the white space around the glyph. The font size is set to 15.

fontinfo -f web.ttf -r -C / -S 15

The output for a single glyph in the font file is shown below:

Range: 0x2030 (8240)
        0x2030 (8240, utf8:0xe2 0x80 0xb0, glyph index:16):
        Size: 19,17, render offset: 0,17
        Metrics: Adv.=0014.0000, BearingX,Y=0000.0000,0000.0400, maxX=0000.04C0
        ///////////////////
        ////////**/////////
        /***////*//////////
        **/**///*//////////
        *///*//*///////////
        *///*//*///////////
        *///*//*///////////
        **/**/*////////////
        /***//*////////////
        //////*//***///***/
        /////*//**/**/**/**
        /////*//*///*/*///*
        ////*///*///*/*///*
        ////*///*///*/*///*
        ////*///*///*/*///*
        ///*////**/**/**/**
        ///*/////***///***/

See also:

In the Photon Programmer's Guide see: Fonts