Skip to main content

Module cff_parser

Module cff_parser 

Source
Expand description

CFF (Compact Font Format) binary parser.

Parses CFF binary data (Adobe TN#5176) into structured CffFont objects. CFF is a compact binary encoding for Type 1-style fonts using Type 2 charstrings.

CFF data appears in PostScript via the FontSet resource mechanism: FontSetInit /ProcSet findresource begin … StartData

This parser handles:

  • CFF Header, Name INDEX, Top DICT, String INDEX, Global Subr INDEX
  • CharStrings INDEX, charset, encoding, Private DICT, Local Subr INDEX
  • Both name-keyed and CID-keyed fonts
  • Predefined charsets (ISOAdobe, Expert, ExpertSubset) and encodings

Structs§

CffFont
A parsed CFF font.
FdEntry
Per-FD entry for CID fonts (from FDArray).

Constants§

EXPERT_ENCODING_MAP
Expert Encoding — (code, SID) pairs for non-zero entries.

Functions§

get_sid_string
Resolve a String ID (SID) to its string. SID 0–390 are predefined standard strings. SID >= 391 indexes into the String INDEX (offset by 391).
parse_cff
Parse CFF binary data into a list of CffFont objects.