Tincture.Font.TTF.Cmap (Tincture v0.1.0)

Copy Markdown View Source

Parser for the TrueType/OpenType cmap table.

cmap maps Unicode codepoints to glyph indices. It is the table that decides whether a font can render a given character at all, and it comes in several incompatible subtable formats - format 0 (byte), 2 (high-byte mapping for legacy CJK encodings), 4 (segmented, the common BMP case), 6 (trimmed), 12 (segmented 32-bit, needed for anything outside the BMP) and 14 (Unicode variation sequences).

Each format is a separate on-disk layout, which is why this is 30 functions rather than one. Extracted from Tincture.Font.TTF, where it was reachable only through parse_basic_tables/1.

Summary

Functions

parse_cmap_by_code(data, table_records)

parse_cmap_variation_metadata(data, table_records)