Minimal TrueType (sfnt) parser — just enough metadata to embed a font in a PDF as a simple /TrueType font with WinAnsi encoding.
Reads the table directory and pulls what the PDF FontDescriptor and /Widths array need: units per em, bounding box, ascent/descent, cap height, italic angle, weight, and per-character advance widths for the WinAnsi range (32..255).
CFF-flavoured OpenType (OTTO) is rejected: those need /FontFile3,
which is out of scope for now.
Summary
Functions
Parses a TTF binary. Returns {:ok, metrics} or {:error, reason}.
Functions
Parses a TTF binary. Returns {:ok, metrics} or {:error, reason}.
Metrics (all font-design values already scaled to a 1000-unit em, as PDF expects):
:ascent,:descent,:cap_height,:italic_angle,:bbox:stem_v— estimated from the OS/2 weight class:widths— advance widths for WinAnsi codes 32..255, in order