outline_convert.ttf

outline_convert

ttf(bytes) -> font, err

Read a TrueType font

font.cfg holds the metrics in the font's units: em, ascender, descender, x_height, cap_height, underline_pos, underline_thickness, strike_pos and strike_thickness. A font without OS/2 or post reads 0 for what those tables hold.

font:glyph(codepoint) answers the glyph's index, or nil. font:codepoints() answers the whole map, codepoint to index. font:advance(index) answers the advance. font:outline(index) answers the contours, each a list of points { x, y, on }, with a composite flattened; or nil and an error. font:rules(tags) answers the GSUB lookups the module's block describes, each { index, rules }, a rule { input, behind, ahead, map } with its sets as index -> true and its map as index -> index or nil; or nil and an error naming the lookup it cannot express. A font with no GSUB, or no tags, answers an empty list.

Nil and an error for a file that is no TrueType font, holds CFF outlines, or ends before a table it names.