Skip to main content

Module fontmeta

Module fontmeta 

Source
Expand description

Font metadata stored at import as fontMetas, in the shape Eagle’s font parser produces (see the Import chapter of the docs).

Each name table entry becomes a map from language code to text, keyed by the entry’s name (fontFamily, postScriptName, …), followed by numGlyphs, support and weight.

Structs§

FontInfo
The font viewer’s information panel, read from fontMetas as Eagle’s viewer reads it: each name in English when the font has it, else its first language. Missing names are empty.

Constants§

SAMPLE_LANGUAGES
The sample languages Eagle’s “change language” offers, as stored in fontMetas.preferLng, with their names.

Functions§

font_metas
Builds fontMetas for a font file’s bytes, or None if it can’t be parsed. fallback_id names a font whose table has no names at all.
names
The name table as Eagle’s parser reads it: entries in table order, each a map from language code to text. A later record for the same entry and language replaces the earlier text but keeps its position.
parse
Parses a font file (ttf, otf, or the first face of a ttc); unpack WOFF and WOFF 2 with sfnt first.
sfnt
Unpacks a WOFF or WOFF 2 file into the plain sfnt it wraps; other data is returned as is. From WOFF 2, tables stored with a transform (the packed glyf/loca and hmtx) are left out: metadata needs only the names, maxp, cmap and the other plain tables.
weight
Eagle’s weight label, guessed from the PostScript name, then from the subfamily, with “ Italic“ added when the PostScript name says so.