sparkles:font — Decisions
The consequential choices behind SPEC.md, with the evidence and trade-offs of each, and the open questions that block named requirements. A decision is proposed until the specification is accepted.
Exclusions and entry conditions
Each capability below is outside the specification. An entry condition says what evidence would bring it back; without one, the item is not planned.
| Excluded | Why | Entry condition |
|---|---|---|
| Line breaking, bidi, paragraph layout | Base owns analysis/opportunities and generic solving; text-layout owns contextual composition. | None in this library; link their owning contracts. |
| Bytecode hinting; horizontal grid fitting | The largest single part of every rasterizer that has it; horizontal fitting distorts widths. | A face that draws wrongly without its bytecode (FTD12) and a consumer that must show it. Light vertical fitting is in: FTX17. |
| LCD subpixel anti-aliasing | Colour fringes off RGB-stripe panels; cannot composite over arbitrary backgrounds. | None. |
COLR version 1 rendering | A paint graph with gradients and compositing, a small renderer of its own. | After COLR version 0 ships, when a consumer needs it. |
SVG glyphs | Needs an SVG renderer. | None. |
| WOFF and WOFF2 | Web containers; WOFF2 needs a Brotli decoder and table reconstruction. | A consumer that must open web fonts. |
Type 1 and dfont | Legacy formats. | None. |
| Writing, subsetting or instancing files | No consumer writes fonts. | None. |
| A D OpenType shaping engine | See FTX1. | A target that must shape and cannot link HarfBuzz. |
| GPU rasterization | Bitmap specimens and cell glyphs do not need it. | A consumer drawing transformed or continuously zoomed text. |
| Font activation, network catalogs | Application features, not library features. | None in this library. |
| Math composition, pagination and export | Font supplies MATH/baseline/justification resources, not formula or page policy. | None in this library; composition and frontends remain above font. |
Settled scope (2026-10-02 design interview)
These were decided by the project owner in the interview that scoped the font explorer, before the research ran. They bound this specification rather than being decided by it:
- The
raylib-textFreeType/HarfBuzz code from PR #555 was a spike; the font stack is rewritten from scratch, with no compatibility obligation outside the repository. Every in-repository consumer is updated. - One library with configurations, not several packages. Discovery and DPI arithmetic move out of
raylib-textinto it. - D wherever possible; a C shim is to be minimized. GPU compute through
sparkles:shadersis available if needed. - The Android
hueAPK building is a hard gate for the migration. - Formats in: TrueType, CFF-flavoured OpenType, collections. Bitmap emoji and
COLRv0 in. WOFF, WOFF2, Type 1 anddfontout.
FTX1: HarfBuzz is the shaper
State: accepted 2026-10-06 · Affects: FTS1–FTS11, the engine configuration
Question. Write an OpenType shaping engine in D, or use HarfBuzz?
Evidence. Every independent shaper surveyed costs 16–30 thousand lines: rustybuzz (~17 KLOC, a HarfBuzz port, archived in favour of a fresh port because it could not keep up), go-text (~16 KLOC port, maintained by porting releases), Allsorts (~17 KLOC, independent), SixLabors.Fonts (~30 KLOC of C#). HarfBuzz is already in every consumer's link closure since PR #555.
Choice. HarfBuzz, in the engine configuration only, so the library configuration stays free of C dependencies.
Trade-off. Shaping cannot run where HarfBuzz is not available; wasm32 would need HarfBuzz compiled for it. Shaping bugs are HarfBuzz's to fix upstream.
Revisit when a target that must shape cannot link HarfBuzz.
FTX2: HarfBuzz through hand-declared prototypes
State: accepted 2026-10-06 · Affects: FTA8, FTS6
Question. Reach HarfBuzz through ImportC of hb.h, a C shim, or hand-declared extern(C) prototypes?
Evidence. Both research examples drive HarfBuzz — faces, fonts, buffers, shaping, variations, axis queries, outline drawing — with hand-declared prototypes over opaque handles and five plain structs, and run under ci. A C shim was the spike's approach and is what this rewrite removes. ImportC of hb.h through a package forces sourceLibrary on every package between it and the executable, which already broke the macOS build once for sparkles:ghostty.
Choice. Hand-declared prototypes in one module. The risk that hand-written layouts drift from the headers is closed by FTS6: a test-only ImportC file checks sizes and offsets against the installed headers, so drift fails a test instead of corrupting memory.
Trade-off. Each further HarfBuzz function is declared by hand.
Scope (2026-10-15). The choice covers the library's engine configuration. The test-only oracle, libs/font-oracle, declares HarfBuzz by ImportC of hb.h and hb-ot.h instead: nothing depends on it, so the sourceLibrary constraint stops at the oracle itself, and the real headers replace hand-written layouts that no header check covered. The switch also typed four enum parameters (metrics, math-constant, math-kern and baseline tags) that the hand-written prototypes declared as plain integers. sparkles:raylib-text already reaches HarfBuzz through ImportC, so whether the engine configuration should follow is revisited when M4 starts.
FTX3: An own parser; FreeType is an oracle, not a dependency
State: accepted 2026-10-06 · Affects: FTP*, FTO*, FTR1–FTR3, FTA7
Question. Parse and rasterize through FreeType, or in D?
Evidence. The research verdict for a D CPU rasterizer is go: the signed-area accumulation core is 71 lines in the research example and ~200 lines in fontdue and ab_glyph, and Fontations proves an own outline path differentially against FreeType. The explorer must expose every table and feature, which no rasterization library's API does; an own parser is needed for inspection regardless. Hinting, the one part that is large, is a non-goal.
Choice. Parsing, outlines and rasterization in D. FreeType stays in the dev shell as the rasterization oracle for FTR3, never as a runtime dependency.
Trade-off. Unhinted text on low-DPI panels is softer than FreeType's hinted output; this is accepted, with the hinting entry condition under exclusions.
FTX4: PNG strikes decoded in D over Phobos's zlib
State: accepted 2026-10-06 · Affects: FTR7, FTA14
Question. How are CBDT and sbix colour glyphs (the bundled Noto Color Emoji is a CBDT font with no outlines) rendered without FreeType?
Evidence. LDC 1.42's libphobos2-ldc defines inflate and inflateInit2_ itself (an inflate.c.o member, checked with nm on the installed library), so etc.c.zlib needs no extra library. PNG decoding past inflate is filter reversal and palette expansion.
Choice. A D PNG decoder limited to what emoji fonts use (FTR7), delivered before the terminal migration so emoji do not regress.
Trade-off. Interlaced or 16-bit PNGs in a font are refused rather than decoded; no surveyed emoji font uses them, and the refusal is a reported error.
Amended 2026-10-27. The decoder is now sparkles:image's, the one the terminal's kitty graphics use, held to stb_image over PngSuite; sparkles.font.png maps its refusals to FontErrors. It decodes every form the format defines, so the trade-off above no longer holds.
FTX5: Platform services list files; the library describes faces
State: accepted 2026-10-06 · Affects: FTD1–FTD3
Question. Should matching use fontconfig, Core Text and DirectWrite's own matchers, or one matcher over records this library produces?
Evidence. Android has none of these services, so one path must exist without them anyway; the bundled fonts carry precomputed .charset sidecars for that reason. crossfont and Ghostty show charset-pruned fallback, go-text's Footprint shows a cached record as the unit of a font list, and font-kit shows the cost of describing faces without a cache.
Choice. Platforms contribute file lists only (FTD2). Records, matching and fallback are this library's on every platform, so behaviour is testable and identical everywhere.
Trade-off. User fontconfig rules (aliases, rejections, per-font rendering preferences) are not honoured. Revisit when a user-visible mismatch with the system's fallback is reported.
FTX6: Requirement prefixes
State: accepted 2026-10-06
FT plus a letter per area: FTA architecture, FTB trust boundary, FTP parsing, FTV variation, FTM metrics, FTO outlines, FTR rasterization, FTS shaping, FTD discovery, FTI inspection; FTX decisions and FTQ open questions. None was in use under docs/specs/ on 2026-10-03.
FTX7: Ligatures keep one glyph per cell; their ink crosses cells
State: accepted 2026-10-06 · Affects: FTR1, FTS4, FTA16, milestone M8 · Resolves: FTQ3 for the measured corpus, not arbitrary OpenType text
Question. Does any common programming font's calt or liga merge characters into fewer glyphs, so that a terminal would need multi-cell glyph placement?
Evidence. ligature-cells.d shaped 160 ligature sequences, the union of the four fonts' inventories, each as a<seq>b with calt and liga on and off, on 2026-10-03. "Reach" is how far, in cells, a glyph's ink extends outside the cell its advance occupies.
| Face | Shaped differently | Glyph count changed | Off-cell advance | Ink outside own cell | Worst reach |
|---|---|---|---|---|---|
| Cascadia Code 2407.24 | 131 | 0 | 0 | 126 | 2.77 (<!--) |
| Cascadia Code NF 2407.24 | 131 | 0 | 0 | 126 | 2.77 (<!--) |
| JetBrains Mono 2.304 | 127 | 0 | 0 | 127 | 2.89 (####) |
| JetBrains Mono Nerd Font Mono 3.4.0 | 127 | 0 | 0 | 127 | 2.89 (####) |
| Fira Code 6.2 (variable) | 138 | 0 | 0 | 122 | 2.95 (<!--) |
| Fira Code Nerd Font Mono 3.4.0 | 138 | 0 | 0 | 122 | 2.96 (<!--) |
| Maple Mono 7.9 | 124 | 0 | 0 | 117 | 6.00 ([ERROR]) |
| Maple Mono NF CN 7.9 | 126 | 0 | 0 | 119 | 6.00 ([ERROR]) |
In those measured samples every face keeps one glyph per character at the cell advance: a ligature is drawn by spacer glyphs, the last of which carries the whole shape and reaches back over the cells before it.
Choice. Glyph i in cell i is an audited fast path, not the library's general placement contract. A run may take it only when its selected face, instance, features, input and cluster mapping establish one glyph per source cell with cell-grid advances. The measured 160 sequences establish feasibility for those eight face builds, not all strings or future versions of those fonts. A failed or unavailable audit routes through general shaped positions and source-cluster spans; it does not misalign or reject an otherwise valid shape. Both paths do not clip ink to a glyph's nominal cell, and redraw every cell the ink reaches when any of them changes. FTR1 ink bounds determine damage, not advance or source coverage.
Trade-off. General placement must handle ligature merges, spacer glyphs, multiple marks, RTL traversal and multi-cell source spans. The explorer's cell-grid audit reports which inputs satisfy the fast path; it is not a condition for correct general shaping. This narrowing retains the measured evidence while removing the inference that OpenType permits a universal glyph-index-to-cell-index mapping.
FTX8: The catalog builds synchronously over a worker pool
State: accepted 2026-10-06 · Affects: FTD1–FTD3, milestone M7 · Resolves: FTQ2
Question. Is describing every font file on a machine fast enough to do synchronously at launch, or does the catalog need a background builder and a progress surface?
Evidence. font-scan-timing.d reads the table directory, the family name, the OS/2 weight class and the code-point coverage of the best Unicode cmap subtable of every face, through mmap, on 2026-10-03 (AMD Ryzen 9 7940HX, NVMe, ZFS):
| Font set | Files | Size | First pass | Warm, serial | Warm, 4 workers |
|---|---|---|---|---|---|
Linux desktop (fc-list) | 2,222 | 2.85 GB | 1,564 ms | 44 ms | 20 ms |
The bundle (sparkles-fonts) | 180 | 125 MB | 23 ms | 1.9 ms | 1.8 ms |
The desktop's first pass read files no process had read since boot; it is the only cold figure, because eviction needs root and ZFS's cache ignores posix_fadvise. Neither set holds a collection, so each file is one face.
Choice. The catalog builds synchronously, on a worker pool, with no background builder and no progress surface. The FTD3 cache stays: it turns the cold first launch after boot into one stat per file.
Trade-off. A cold launch with a stale cache over a large font set blocks for over a second, measured here at 1.6 s single-threaded. Revisit when a warm build exceeds 1 s on a supported platform; Android's /system/fonts and macOS are not yet measured.
FTX9: Flatten to 0.02 px; render the union of flagged glyphs
State: accepted 2026-10-04 · Affects: FTR1–FTR3, FTR8, FTI6, milestone M5 · Resolves: FTQ4
Question. How does the accumulation rasterizer flatten curves, and how does it keep overlapping contours from doubling edge coverage (FTR2)?
Evidence. Spike S2 ran raster-oracle-diff.d over the 48,330 glyphs of four bundled faces at four sizes (testing.md § Raster oracle). Plain accumulation adds the coverage of every edge that crosses a pixel, so a pixel half-covered by the edges of two overlapping contours reads as fully covered. Maple Mono NF CN builds its CJK glyphs from overlapping strokes; there, 59% of glyphs differed from FreeType by more than 32 steps, the worst by 123. FreeType avoids this only for glyphs whose glyf data sets OVERLAP_SIMPLE or OVERLAP_COMPOUND, 22,931 of that face's 33,637: it renders them at 4×4 and averages (ttgload.c, ftsmooth.c). Doing the same brought every glyph of the face within 33 steps. Supersampling every glyph costs 6–10× a plain render: 11–33 µs rise to 64–327 µs per glyph from 12 to 48 px on Fira Code Nerd Font Mono.
No surveyed library computes the union exactly and cheaply. fontdue, ab_glyph, stb_truetype and Go's x/image/vector all accumulate signed area and over-cover overlaps; Vello's exact-area mode documents the same "conflation artifacts" and escapes only through multisampling. Fontations reports the flag to its renderer as has_overlaps.
Overlaps without the flag are common. Comparing each unflagged glyph with its 4×4 render at 24 px, 192 glyphs of Fira Code Nerd Font Mono and 428 of the 1,392 in Noto Sans Arabic differ by more than 32 steps. Noto Sans Arabic is a variable font that overlaps its contours and sets no flag; FreeType renders it the same way, which the matching FreeType comparison confirms.
Choice. Curves are flattened adaptively to 0.02 px. A glyph flagged OVERLAP_SIMPLE or OVERLAP_COMPOUND renders at 4×4 and is averaged; every other glyph renders by plain accumulation, which is FreeType's rule. The caller may request the 4×4 union for every glyph, and the library reports each glyph's flag (FTI6), so the font explorer can find unflagged overlaps.
Trade-off. Unflagged overlaps, including Noto Sans Arabic's joins, render with darker edges where contours overlap, exactly as under FreeType. Revisit when a side-by-side capture at a terminal size shows that darkening in a face users rely on; the remedy then is the union for that face, not for every glyph.
FTX10: Two raster oracles
State: accepted 2026-10-04 · Affects: FTR3, FTR8, milestone M5 · Resolves: FTQ1
Question. What tolerance against FreeType makes FTR3 falsifiable, when the two rasterizers flatten curves differently?
Evidence. Against FreeType with default flattening, the largest per-pixel difference was 33 steps on TrueType faces and 53 on the CFF face. Reproducing FreeType's flattening rules in the D sink lowered the median glyph maximum to 3 or 4 on every face: most of that difference is FreeType's flattening, which bisects a cubic only until each control point is within about 1/6 px of a trisection point of its chord. A tolerance wide enough for it would hide errors in the accumulation arithmetic. Fontations' PathStyle::FreeType and PathStyle::HarfBuzz reproduce each engine's outline quirks bit for bit, which is the precedent for a compatibility policy.
Choice. Two checks, each tight. FTR3 compares with FreeType under a flattening policy that reproduces ftgrays.c, so it measures the arithmetic. FTR8 compares default flattening with the same rasterizer at 0.001 px, so it measures the flattening. testing.md § Raster oracle records both tolerances.
Trade-off. The library carries a flattening policy whose only purpose is compatibility. It is a few dozen lines and is also useful to a consumer that must match FreeType's rendering.
FTX11: One owner for Unicode and paragraph semantics
State: accepted 2026-10-06 · Affects: FTA15, FTS7–FTS9, FTD7
Question. Should font continue exposing shaping as an isolated UTF-8 string operation, with independently guessed Unicode properties and paragraph context?
Choice. Font depends on base's owned text foundation, never on text-layout. Base owns UTF/Unicode analysis and generic wrapping; layout owns paragraph context, candidate composition and visual mappings. Font consumes explicit segment properties and supplies real contextual measurements, safety flags and whole-span fallback evidence. Standalone property guessing remains a named convenience, not a parallel owning paragraph-analysis path.
Trade-off. Callers must preserve source context and distinguish actual text boundaries from style/script/fallback boundaries. The font-to-layout cutover updates every caller and removes competing decoding/segmentation/placement helpers. A layout candidate cannot be measured by summing nominal advances or reusing unsafe shaped fragments.
Evidence state. This is a boundary contract, not a font implementation result. The owner accepted it with the font specification on 2026-10-06.
FTX12: Unicode callbacks do not replace an engine compatibility profile
State: accepted 2026-10-06 · Affects: FTS8, milestone M4
Question. Is installing base-backed HarfBuzz Unicode callbacks enough to ensure all shaping uses the selected Unicode release?
Choice. Install all supported callbacks from the pinned base data, and pin the exact engine release/revision with an audited compatibility manifest for internal tables and algorithms that callbacks cannot replace. A callback-only claim is insufficient; an uncovered mismatch blocks coordinated shaping. No runtime font path fetches data or inherits the compiler's Unicode version.
Trade-off. Updating HarfBuzz or base's Unicode release is an explicit compatibility-profile update and real-font acceptance run. The ABI layout test does not prove Unicode compatibility, and the engine's own goldens are not an independent shaping oracle. An unsupported system engine is reported rather than used under a misleading profile.
FTX13: Scalable resources below publication composition
State: accepted 2026-10-06 · Affects: FTP13, FTM4–FTM7, FTS10–FTS11, milestones M2/M4
Question. Can pixel-only measurements and feature names serve contextual paragraphs, vertical writing and mathematical publication?
Choice. Add design-unit and base-owned physical-unit measurements while retaining fractional pixel convenience and whole-device-pixel cell metrics. Expose MATH, BASE, vertical metrics, GDEF carets and justification capability records with explicit absence/provenance and actual candidate shaping. Ink and advance remain different quantities. Font supplies data; math composition, justification policy, pages and export do not move into font.
Trade-off. Real math, vertical and caret/justification corpus evidence is a delivery prerequisite, not optional demonstration. Missing tables are legal font inputs, but testing only their absence cannot accept a supported capability. The acceptance manifest records the pinned faces and measured values; no such measurement is claimed by this decision.
FTX14: A startup slice before M3
State: accepted 2026-10-16 (owner) · Affects: MS, M5, M7, M8
Question. The terminal's first frame on a phone waits about 208 ms on building font atlases and about 45 ms on scanning and probing font files. Should the font plan answer that now, and how, given that M8 is when raylib-text moves onto sparkles:font?
Evidence. A layered startup spike on an Android 14 phone: a raw window reaches its first frame at 210 ms, the toolkit with one system face at 310 ms, the terminal's bundled faces at 518 ms; a vulkan-wsi spike presents at 232 ms, so the renderer is not the cost. Most of the font time builds atlases for faces, sizes and fallbacks the first frame does not draw, and probes files for coverage that sparkles:font reads from borrowed bytes (M1's CharMap, M2's metrics; spike S1 catalogued the bundle in 1.9 ms).
Choice.
- Add a startup slice, MS, ahead of M3. It pulls forward the catalog part of M7 and the consumer part of M8, built as foundations independent of any renderer, because the long-term stack is owned end to end (event loop, window system, Vulkan) and raylib is an interim consumer.
- The glyph cache rasterizes through FreeType behind an interface until M5, which replaces it under the same glyph key.
- Precomputed artifacts come from both the Nix build (the catalog and the design system's token sizes) and an on-device cache keyed by content hash.
- The device scale may change at run time (2026-10-16). The glyph key holds the exact rational ppem, a change rebuilds no catalog and changes no physical measurement, a frame after it rasterizes only what it draws at the new ppem, and entries at other scales stay until evicted, so returning to a scale is warm; the on-device cache keeps entries per ppem across launches.
- Whether the first frame shows legible text or the grid while glyphs rasterize is decided by measuring both, on both the raylib terminal and the
vulkan-wsispike. - The obligation is set after measuring. Its intended shape is a soft wall-clock budget and a hard budget of instructions retired per ISA, which is deterministic and only ever lowered. Work moved onto threads is tracked by its speed-up and parallel efficiency at a fixed worker count,
and , together with the work inflation , so that a wall-clock gain that only adds work shows up.
Trade-off. The slice runs before M3, so outlines and our own rasterizer wait, and FreeType stays in the rendering path a while longer, contained in its own package. The raylib-text adapter waits for the terminal stack to merge, so the first gains show in the vulkan-wsi spike.
FTX15: Compatibility quirks the engines apply, applied visibly
State: accepted 2026-10-26 (owner) · Affects: M7, FTD8–FTD12
Question. HarfBuzz and FreeType recognize particular broken fonts and read them as the fonts' authors meant, not as they are stored. This library reads what is stored. Which of those corrections should it apply too, and how should a caller see that it did?
Evidence. The pinned HarfBuzz 14.6.0 and FreeType 2.14.3 sources, read on 2026-10-26, and the M2 corpus run that met the first of them:
hb_ot_math_get_constantswapsdisplayOperatorMinHeightanddelimitedSubFormulaMinHeightfor Cambria Math, whose two values are stored swapped (harfbuzz#4653), recognized by itsMATHlength (25,722) and those two stored values (2,500 and 3,000). HarfBuzz's ownMathTestFontPretendToBeCambria.ttftriggers it in the corpus.OT::GDEF::is_blocklisted(hb-ot-layout.cc) ignores the wholeGDEFof about forty faces, recognized by the lengths of theirGDEF,GSUBandGPOS: Times New Roman Italic and Bold Italic, Tahoma, Microsoft Himalaya, Cantarell 0.0.21, Padauk 2.5 to 3.0 and Courier New, from Windows 7 to 10 and macOS 10.9 to 15. TheirGDEFclasses spacing glyphs (", IPA letters) as marks, which the shaper would zero.cmap's symbol path (hb-ot-cmap-table.hh) maps Arabic text into the private-use glyphs of old Windows Arabic fonts, which have only a symbolcmapand name their code page in anOS/2version 0fsSelectionhigh byte (0xB2Simplified Arabic,0xB3Traditional Arabic), through tables generated from Microsoft's legacy Arabic font documentation (hb-ot-shaper-arabic-pua.hh); its Arabic fallback shaper then shapes them.tt_check_trickyness(ttobjs.c) marks about thirty CJK faces, by 20 family names (DynaLab'sDFandDLCfamilies,MingLiU,PMingLiU,HuaTian) or by the lengths and checksums of 31 faces'cvt,fpgmandprep, whose glyphs are assembled from components only their bytecode positions; FreeType always hints them.- Considered and left out:
morx's blocklist (one face, in Apple's layout tables, which this library does not read); FreeType's padding of hinting limits (Rubik Italic, Keystrokes MT) and its repair of zeroed checksums, which serve a bytecode interpreter; HarfBuzz's shaping fallbacks (Arabic forms withoutGSUB, mark positioning, thekerntable, space widths, synthesized glyph classes), which this library inherits through the shaper (FTX1); and the line-metric fallbacksFTM16already specifies. FreeType's repair of a bitmap strike whose ascender is zero belongs toFTR7and M6.
Choice.
- One registry holds every correction this library applies, each with an identifier, the signature that triggers it, its effect and the engine and revision it follows (
FTD8). A signature is read from the face's own bytes (table lengths, stored values, table checksums, names), as the engines' are, never from a file hash, which differs between operating system builds of the same font. - The four corrections above are its first entries (
FTD9–FTD12): they change what layout, the explorer and fallback see, and in each case the shaper already applies the same correction, so leaving it out makes this library disagree with the text it shapes. - A correction is reported where it applies: every result it changes says so, and a face record lists the corrections its face triggers. A caller can open a face with corrections off and read the stored values.
- Amended 2026-10-28 (owner): corrections are opt-in in this library, so
openFaceandbuildCatalogdefault to the stored values, and the Sparkles GUI stack turns them on by default when it adopts the library (M8). A library that reads fonts reports what they hold unless asked; the stack that draws text beside the shaper asks. - The registry is part of M7, because the face record carries it, and two of its entries decide fallback: legacy Arabic code pages change a face's character coverage, and a tricky face cannot be drawn by this library's rasterizer.
Trade-off. Each entry follows one engine's judgement about one font and can go stale when the font is fixed; the signature, not the family name, keeps a fixed version from triggering it, and the engine revision recorded with each entry says which list to compare against when the pin moves. A reader who wants the bytes as stored must ask for them.
FTX16: Codepoint routes override the primary
State: accepted 2026-10-28 (owner) · Affects: FTD5, FTD6, discovery.md FTD31, FTD33
Question. A user routes a range of codepoints to a font, such as Nerd Font symbols, a preferred CJK face or colour emoji. Does the route win over a primary font that covers those codepoints, or does it only fill what the primary lacks? And where does it sit in the chain?
Evidence. A survey on 2026-10-28 of the systems that have such routes and of the general text stacks, from their sources at pinned commits:
| System | Route mechanism | Overrides a covering primary? |
|---|---|---|
| kitty | symbol_map | yes, checked before the main font, without a coverage check |
| Ghostty | font-codepoint-map | yes, checked first; a routed font lacking the glyph falls through to the chain |
| iTerm2 | special exceptions of the non-ASCII font | yes, checked first |
| DirectWrite | IDWriteFontFallbackBuilder::AddMapping | no: the base family first, mappings fill what it lacks |
| CSS Fonts 4 | unicode-range | only within one family, composing it |
| WezTerm, Alacritty, foot, Windows Terminal, Core Text, Android, Pango, Skia, parley, cosmic-text | none; ordered fallback lists | no routes; fill only |
Every system with explicit codepoint routes treats them as overrides, which is what their users mean: a main font's own Powerline, CJK or emoji glyphs are what they route away from. Fill-only ranges are a fallback family restricted to a range. The survey also found that a route kept only as a chain entry is defeated by whole-span trials: a mixed span such as a prompt with one Powerline glyph cannot be shaped by the route, so the primary shapes it whole, routed glyph included. kitty and Ghostty choose a font per cell before building runs.
Choice.
- A route overrides the primary for the scalars its ranges hold and its face covers; a route whose face lacks a scalar lets it fall through to the chain, as Ghostty does, rather than drawing
.notdef, as kitty does. routeEntry(cp)answers which route claims a scalar. Layout, which owns span boundaries (FTD7), splits spans so that the clusters a route claims by their base scalar are tried apart from the rest; the chain keeps routes first for those spans.- The match stays the source of cell metrics. A fill-only range, if needed, is a fallback family restricted to the range, not a second kind of route.
Trade-off. Ligatures and shaping context do not cross a route boundary. Icon, Powerline and emoji ranges are not ligature components, so the common routes lose nothing; a user who routes a script loses cross-boundary shaping inside it, which is what routing that script asks for.
FTX17: Light hinting, vertical only, in D
State: accepted 2026-10-28 (owner) · Affects: FTR9, the exclusions above
Question. Hinting was excluded until a measured legibility gap at terminal sizes that gamma-corrected unhinted coverage could not close. Has that gap been measured, and how much hinting closes it?
Evidence. The Vulkan canvas's text, composited in linear light with a contrast correction, set beside ghostty, kitty and Chromium at 13.7 px: the composited text matched Chromium's weight but stayed softer than the terminals', whose baselines, x-heights and crossbars sit on single pixel rows. All three draw through FreeType with light (vertical-only) hinting on Linux. Against FreeType's auto-hinter in light mode, DejaVu Sans Mono and Fira Code letters and digits at 11–16 px differ by 21.6 coverage steps on average unhinted; a vertical-only fitter in D (blue zones from reference glyphs, the x-height's overshoot rounded up from three eighths, stems moved but not resized, every other point interpolated) brings that to 6.9, with the x-height and baseline rows matching in 614 of 624 letters.
Choice. Light hinting in sparkles.font.hinting, applied to decoded outline segments before rasterization when the caller passes hints, and nothing more: no bytecode interpreter, no horizontal fitting, no stem widening. The rasterizer, its accumulation and its FreeType differential are unchanged; the hinted outline is still measured in font units.
Trade-off. It follows the Latin model of FreeType's auto-hinter, so scripts whose zones x, H, o, O, d and p do not describe fit only their edges to the nearest row. Fira Code at 11 px comes out slightly further from FreeType than unhinted; every other measured size is three to five times closer.
Open questions
FTQ1: Raster tolerance for FTR3
Answered by spike S2; see FTX10.
FTQ2: Background or synchronous scanning
Answered by spike S1; see FTX8.
FTQ3: Ligatures that change glyph count in a cell grid
Answered by spike S3; see FTX7.
FTQ4: Overlaps the font does not flag
Answered on review of spike S2; see FTX9.
Text-foundation extension review
The 2026-10-04 coordinated text-foundation extension received a separate read-only adversarial review of contextual shaping, units, source-cluster coverage, safety flags, caret data, publication font capabilities and fallback. The reviewer found that FTD5 coverage-only admission contradicted FTD7 whole-span shaping trials. FTD5 now retains shaping candidates with identical/subset character coverage and keeps scalar coverage pruning separate; the real-sequence acceptance scenario in testing.md checks chosen face, glyphs and source outcome. A final scoped recheck found that blocker resolved.
This review covers the text-foundation extensions, not independent acceptance of the entire font Stage 0 or an absent font implementation. Existing raster-spike evidence remains scoped to its measured fonts, sizes and revisions.
M1 operation-contract review
On 2026-10-05 an independent read-only reviewer walked the first draft of parsing.md and SPEC.md § 2–7 against HarfBuzz and FreeType sources, with fourteen traces: a TrueType and a CFF success, seven failures (a truncated head, an unsorted directory with a duplicate tag, a malformed preferred cmap subtable, post 2.0 with a glyph-count mismatch, a UTF-16 name with an unpaired surrogate, a format-12 group past U+10FFFF, a collection index out of range) and five boundaries (4,096 and 4,097 directory records, an offset plus length past 32 bits, numberOfHMetrics equal to the glyph count and to 1, a wrapping format-4 segment). Its findings and their dispositions:
| Finding | Disposition |
|---|---|
Blocker: duplicate tags failed the open in FTP3 but not in the draft | FTP3 amended: the first record is the table, later ones are reported (FTP21). |
| Blocker: the subtable order ignored symbol (3/0) and Macintosh subtables | FTP9 amended and FTP25 adopts HarfBuzz's order, with the symbol remap and Mac Roman conversion. |
| Blocker: strict validation with no fallback refused fonts both engines render | FTP25–FTP26: lenient checks (a corrected length, overlapping format-4 segments, out-of-range targets unmapped), then the next subtable; every rejection is counted and reported. Where the checks differ from FreeType's, parsing.md § 7 lists it. |
| Blocker: overlapping format-4 segments broke the linear bound and the sorted ranges | FTP26: effective spans [max(start, previous end + 1), end]; bound O(L + 65,536). |
Major: a quadratic duplicate check at open contradicted FTP5 | FTP20: open is O(r); duplicate flags are computed by inspection (FTP33). |
| Major: static name tables broke the borrowing rule | FTP16 allows immutable static data. |
Major: post version cases undefined; HarfBuzz rejects 2.5 | FTP30 result table; FreeType is the 2.5 oracle (§ 7 of parsing.md). |
Major: "no usable post names" undefined; predefined charsets missing; no CFF name index | FTP31: per-glyph fallback, the three predefined charsets, glyphNameIndex covers CFF. |
| Major: oracles diverge from the contract by design | parsing.md § 7 lists each divergence with its substitute oracle. |
Major: checkSumAdjustment cost and meaning for collections | FTP33: whole buffer for a single font, not applicable in a collection. |
| Major: error kinds missing | FTP26 names an error per check; FTP29 gives decodedLength the decode error; avar no longer depends on fvar in M1. |
Minor: wrong cross-reference, Mac Roman language variants, head version, indexToLocFormat at open, fvar instanceSize, unsourced table-count claim, version-0 language IDs, error offsets for invalid tables, the limit's identity | Each fixed in parsing.md; the table-count claim now cites 2,402 measured faces. FTP14 carries an absolute offset always, and a table offset when the table is readable. |
The review confirmed the OS/2, head, maxp and post length rules, the 391 standard CFF strings, and the format-12 rule for glyphs past numGlyphs.
The same reviewer then rechecked the repaired draft. All eleven repeated traces, and a new one for a symbol font, now have a single correct outcome, and no blocker remains. Its remaining findings and their dispositions:
| Finding | Disposition |
|---|---|
| Major: trimming format-12/13 groups against the previous end did not keep spans disjoint | FTP26 also requires group ends to be non-decreasing, so effective spans stay disjoint. |
Major: four oracle divergences missing (symbol and Mac Roman coverage, format-4 overlap resolution, hmtx leniency, the post-to-CFF fallback on error) | Listed in parsing.md § 7 with substitutes; FTP31 now falls back on a post error too, as HarfBuzz does. |
Minor: FTP10 cost, the rejection error on CharMap, HarfBuzz's Arabic remap, format-14 error kinds and out-of-range variants, format 6 past 65,536, glyph-ID arithmetic, spacing with truncated entries, the glyphNameIndex scratch length, a truncated format-0 charset, the Top DICT in the cost bound | Each fixed in parsing.md or SPEC.md. |
The reviewer's gate verdict: with these fixed, the M1 contracts meet the Stage 0 criterion of first-slice contracts at operation level with oracles.
The HarfBuzz oracle later overturned one disposition. The first review's post finding treated name indices of 32,768 and above as reserved, an older TrueType reading; current OpenType allows 258–65,535, and Maple Mono NF CN uses them for 875 glyphs. FTP30 now accepts them.
M2 operation-contract review
On 2026-10-14 an independent read-only reviewer walked the first draft of variation-metrics.md against SPEC.md, parsing.md, base's accepted LayoutUnit contract and the HarfBuzz, FreeType, fontTools, fontations and ttf-parser sources, with twenty traces: four successes (an avar map hit, an HVAR advance converted at 12 points for upem 1,000 and 2,048, a math kern at exactly a correction height, a BASE 1.1 VariationIndex coordinate with and without ppem), ten failures (an avar axis count unlike fvar's, a decreasing segment map, a region list of the wrong axis count, an inner index past the item data, MVAR with 6-byte records, a baseline index past its coordinates, a MATH coverage index past its array, an extension of an extension, a malformed HVAR on a gvar font, CBDT without CBLC) and six boundaries (64 and 65 axes, user values at the axis extremes and a default equal to the minimum, a design sum and a conversion at the 64-bit edge, an avar 2 delta past +1, a delta-set index map of count 0 and an index past it, a cell width of exactly x.5 px). It found 2 blockers, 17 major and 13 minor defects; traces 9 and 14 had no single outcome. Its findings and their dispositions:
| Finding | Disposition |
|---|---|
Blocker: HarfBuzz rounds an HVAR delta to a whole unit and clamps at zero, so it cannot check fractional advances to 1/64 unit | fontations' compute_delta is the exact oracle; HarfBuzz checks advances within 0.5 unit where it does not clamp (§ 9; testing.md, which gains a fontations oracle row). |
Blocker: 24 operations had no worst-case cost (FTB3) | Every operation states one. |
Major: the avar map rule and the avar 2 rounding were not HarfBuzz's | FTV9 states HarfBuzz's algorithm step by step, end-cap trimming included; FTV10 evaluates the store on rounded coordinates and adds the clamped, rounded delta to the unrounded F16.16 value. |
Major: line metrics contradicted FTM2 and invented zero sets for a missing table | SPEC.md FTM2 amended (the typographic set only when non-zero); FTM16 skips absent sets and is absent when none remains. |
Major: MVAR tags misattributed, a short record size and other versions undefined | FTV14: the Windows set takes hcla/hcld only; another version is unsupportedVersion, a short record badValue; the FreeType divergence is listed. |
| Major: a VariationIndex in a static face failed every query | FTM14: at all-zero coordinates no store is read and every delta is zero. |
| Major: overlapping scalar rows and unstated rounding; dangling indices given three different error kinds | FTV12 rows apply in order with fontations' rounding; FTM13: an index from font data past its array is badValue, indexOutOfRange stays for caller indices. |
| Major: extents, the kern step on unsorted or varied heights, the ppem type and device-delta applicability, duplicated axis tags, feature-variation condition formats were undefined | FTM24 case table; FTP37 linear first-greater-than search on resolved heights; FTM10 rational ppem, device deltas only at an integer ppem; FTV7 every axis with the tag; FTI8 format 1 only. |
Major: substitution walks were not linear and glyph sequences could not all borrow; MATH constants failed together; two oracle claims were wrong | FTI9 states the shared-offset cost and a lazy sequence view; FTP35 gives each constant its own result; § 9 corrected (fontations adds zero for dangling outer and inner indices; HarfBuzz's MATH variation deltas are always zero). |
Minor: FTV2, FTM6 and FTP14 wording, an unreachable overflow fixture, versions and absences left unstated, measureRun's error policy, the cell width's source, CBDT without CBLC | SPEC.md FTV2 and FTM6, parsing.md FTP14 (callerStorage) and testing.md amended; each other point stated on the page. |
The same reviewer then rechecked the repaired draft. All twenty traces now have exactly one outcome and no contradiction with SPEC.md, parsing.md or testing.md remains. Its remaining findings and their dispositions:
| Finding | Disposition |
|---|---|
Major: avar end caps are trimmed on the neighbour's from, and a zero value compares the first and last matches, the last winning a tie | FTV9 steps 1 and 3 corrected to HarfBuzz's code. |
| Major: rounding each factor and then the product differs from fontations' one rounding per axis | FTV12: the scalar is updated as round(scalar · numerator / denominator) per axis. |
Minor: line-metric choice on varied values, the FreeType MVAR claim, the axis limit's origin, region-count divergences, assembly absence and cost, vhea-only line metrics, VVAR absence, the kern height at k, the avar 2 delta clamp | Each fixed on the page; the region-count divergences are listed in § 9 with fixtures as substitute. |
The reviewer's gate verdict on the recheck: with the two majors and the minors applied, these contracts meet the bar parsing.md set for M1. Delivered M1 code reports a short caller array as limitExceeded without a named limit; M2 adds the callerStorage limit that the amended FTP14 requires.
The owner accepted these contracts on 2026-10-14 (PR #634 merged), and M2 implementation began against them.
Implementation amended two details of the accepted page. FTP38 called the assembly's italics correction absent when null, but it is a MathValueRecord stored inline: it is always present, and only its Device table can be absent. And § 9 now lists a divergence the review missed: for math-kern heights that do not ascend, HarfBuzz's binary search and FTP37's stored-order scan can choose different steps.
M7 operation-contract review
On 2026-10-28 an independent read-only reviewer walked the first draft of discovery.md, with base's mapping amendment, against SPEC.md § 12–13, HarfBuzz 14.6.0 and FreeType 2.14.3, with 23 traces: six successes (a directory build, a collection with a bad member, a cache hit, a variable family matched at 450 / 100 % / italic, an emoji-presentation lookup, a trial won by the second candidate), four failures (a missing fontconfig, a cache with a wrong hash, a family that matches nothing, a span every face fails) and thirteen boundaries. It found 2 blockers, 17 major and 11 minor defects. Its findings and their dispositions:
| Finding | Disposition |
|---|---|
| Blocker: pruning was unsound — HarfBuzz composes past intervening marks, maps format-14 variants, rotates vertical forms, mirrors bottom-to-top runs, and its Thai, Lao, Hangul, Hebrew, Indic and Arabic shapers decompose, compose and fall back on their own | FTD40 prunes only horizontal runs, on a starter with no decomposition that is no composition's second scalar, followed by a starter it does not compose with and no variation selector, with no covered mirror, in a default-shaper script; checked as a property against hb_shape |
Blocker: a static italic face supports oblique 0°, so normal could choose it | FTD27 gives style as (italic, angle) points; oblique phases consider italic 0 only, italic phases italic 1 only |
Major: the italic order was circular and never reached negative obliques; the ital value was undefined | FTD27's style table lists every phase through negative angles; ital is 1 exactly when an italic phase found the value |
| Major: "position in the search order" is undefined over ranges | FTD28 scores (phase, exact distance) per step |
Major: routes before the primary contradicted FTD5 | FTD5 amended: routes, then the match |
Major: no box face without a primary match, or when cell metrics fail; no k above ppem 16,384; shades of pixel squares overflow glyf at large cells; loose geometry; the cell's vertical extent unclear | FTD31 drops the box entry without a primary; FTD36 reports boxFace and limitExceeded, and states the extent and cost; FTD37 gives exact placement and scales the shade pattern to at most 3,072 contours |
| Major: the store's threading, a rebuilt box face freeing borrowed bytes, a file replaced after the build, and latched failures were unspecified | FTD14: one store per thread; FTD32: every box face kept for the store's life, stale on a changed file, latching stated |
| Major: mapping a file another process truncates faults | FTD16 maps only bundle and platform sources by default and reads the rest |
| Major: equal trial keys did not give equal outcomes (absolute offsets, store state) | FTD43 hashes absolute offsets, and only outcomes with no unopened attempt are cacheable |
Major: memory sources had no content identity; chain identity ignored the correction policy; two sources' equal relative paths collided; policy mismatch and transient failures in the cache were unspecified; precomputed memory sources could not be cached (FTX14) | FTD17 and FTD22: identities carry the source label, memory sources their BLAKE3 hash and are cached; FTD34 hashes the policy; FTD22–FTD23 discard on a policy mismatch and never cache io outcomes |
Major: FTD44's bound ignored HuaTianSongTi's 97,337-byte fpgm and the name decoding | Corrected |
| Major: FreeType's name choice and ASCII conversion were not stated, and only its TrueType driver checks trickiness | FTD46 states both and restricts FTD12 to TrueType outlines; fixtures use real non-ASCII names |
Major: request errors, limitExceeded, a route not covering the run, unbounded attempts and the all-families worst case were undefined | FTD39 fails on request errors and limits candidates (32); FTD42 adds outsideRoute, caller attempt storage and the cost |
| Major: base has no emoji-sequence classifier; non-RGI sequences would never resolve; neighbouring graphemes could be counted | Base has the RGI sequence data (emojiSequences); FTD41 requires ligation of RGI sequences only, counting glyphs inside the grapheme |
| Major: no outcome kinds for libraries, symbols, cache faults or the box face | FTD15 names every outcome kind; FTD23 names every discard reason, structure included |
| Major: symbolic links listed nothing; platform paths were not filtered | FTD16 follows links under the source's ambient authority, at most 40; FTD18 filters platform paths by extension |
Minor: tan at ±90°, the 1,024-byte boundary, alias distinctness, out-of-range axes, the F000 remap under an Arabic page, sanitized GDEF lengths, deduplication and ordering of everything, which records a family selects, the cache's integer widths, partial COLR, no space glyph, report order | Each fixed on the page: whole degrees to ±89 with a tangent table, "at or before", byte equality, clamping, the page's map replacing F000, the divergence noted, (record, coordinates, synthesis), every record with the alias, 64- and 32-bit little-endian, stated, U+0020 added, catalog order |
| Minor: missing scenarios | testing.md adds each, and the review's counterexamples as fixtures |
The reviewer confirmed the Cambria triple, the Arabic page condition and lookup order, FreeType's name-ID order and lists, the U+2011 and space fallbacks, the five-scalar context and emboldenStrength.
The same reviewer then rechecked the rewrite: all 23 traces now have one correct outcome, and it found no counterexample to the new pruning rule among the normalizer's, mirroring's and the shapers' paths. Its remaining findings and their dispositions:
| Finding | Disposition |
|---|---|
Major: a GSUB or morx lookup that covers glyph 0 rewrites the .notdef an uncovered scalar maps to, so pruning could skip a face HarfBuzz draws | FTD40 prunes only faces whose record, from one scan of GSUB at build, shows no subtable can see glyph 0 and no morx; FTD19 records it; a ccmp fixture checks it |
| Major: U+2574–U+257F had no geometry rule; double-line joins as written crossed their inner strokes | FTD37 covers them, and gives doubles their own join rule |
Minor: the script condition's rationale named the wrong shaper choice; "variation selector" undefined; RGI kinds unnamed; FTD5 against free item order; whole-degree angles; key reuse; box-face memory; duplicate labels; FreeType's empty records, last Unicode record and CFF-only exclusion; arc ends and shade clipping | Each fixed on the page |