sparkles:font
sparkles:font reads OpenType and TrueType font files in D. It opens a face or a collection over bytes the caller owns, finds its tables, reads the fixed-layout tables as plain structs, maps characters to glyphs, decodes name records and names glyphs. It builds instances of variable faces with one normalized coordinate vector, measures advances and line, cell, vertical, baseline and math metrics, decodes glyph outlines (glyf composites and gvar, CFF charstrings), rasterizes glyphs to grayscale coverage, and — in the separate engine configuration — shapes text with HarfBuzz. Every read stays inside the caller's buffer, malformed data comes back as a FontError rather than an assertion, and the library configuration allocates nothing and links no C library.
These are milestones M1–M5 of the font specification; discovery and colour glyphs are the later milestones of the delivery plan. Unicode semantics come from sparkles:base.
Documentation
- Tutorial: open a face and map text
- How-to: inspect a damaged font
- Reference: modules, operations and errors
- Explanation: borrowing, checking once, and leniency
The operation-level contracts are in parsing.md, and the testing page describes the oracles that check them, including the HarfBuzz differential suite in sparkles:font-oracle.