Skip to main content

Module parse

Module parse 

Source
Expand description

The bridge from [font-parse]’s borrowed views to this owned model.

Everything else in the crate takes owned data; from_sfnt is the one function that takes foreign bytes. It runs the L0 parser (which is total — malformed input yields a typed [ParseError]) and resolves what it finds into the model: outlines become [Command] streams, hmtx pairs become per-glyph Metrics, cmap becomes owned subtables, name becomes owned strings.

What the bridge does not do:

  • CFF outlines. font-parse exposes the CFF table raw and does not decode charstrings; an 'OTTO' font loads with empty outlines and a CFF opaque table attached.
  • Layout tables. GSUB/GPOS/GDEF are carried through opaquely so a read-modify-write round trip stays lossless. font-shape reorders runs by codepoint class rather than interpreting GSUB.
  • Variation. gvar deltas are not applied; the default instance’s outlines are what load.
  • Instructions. Hinting bytecode is not interpreted; outlines load unhinted.

Functions§

from_font_ref
Resolve an already-parsed FontRef into the owned model.
from_sfnt
Resolve a parsed font into the owned model.
hmtx_rows
Per-glyph metrics, extracted from a glyph store — what a writer serialises into hmtx.
to_outline
Convert a parser contour list into a resolved Outline.