Expand description
Font data and metrics for lightweight-pdf. Knows nothing about the document
model or PDF types (plan/00a-contracts-and-artifacts.md, point 3).
Structs§
- Embedded
Font Metrics - Metrics for a font, keyed by Unicode character rather than a fixed
256-code table (Phase 4 lifts the WinAnsi-only limitation from Phase
0-2’s simple-font text path — Type-0/CID text has no such limit).
Advances are computed lazily via
cmap+hmtxlookups and cached per character, since the same handful of glyphs typically repeat often in one document (invoice/report text, not novel-scale volume — this simplicity/performance trade-off is accepted explicitly for V1: “kein Kerning … zunächst ignorierbar”). - Font
Data - Owns font bytes; a
skrifa::FontRefis only ever created transiently on access, never stored self-referentially (ADR-010 / contract point 3). - Font
Subset - Result of subsetting: a standalone, valid sfnt binary plus the mapping
from each requested character to its new glyph ID in that binary
(used both to encode PDF content-stream CIDs and to build the
ToUnicodeCMap — CID space equals the subset’s own glyph-index space, soCIDToGIDMapcan stay/Identity).
Enums§
Functions§
- subset_
font - Subsets
fontdown to.notdefplus exactly the glyphs needed forchars(including the full composite-glyph closure). Characters the font has no glyph for are silently omitted from the result — the caller decides how to handle that (see the facade’s?fallback).