Two readers of the same bytes, set on one baseline.
Correctness is held to the libraries that came before this one. Fixtures are produced offline, committed as plain data and replayed by MoonBit tests; at test time there is no oracle process, no FFI, no network and no third-party MoonBit module.
U+0041 outline read twice. A disagreement shows at the edges and is recorded as a word plus a mono delta, never as colour alone.| Library | Language | Pinned version | Authoritative for | Flags |
|---|---|---|---|---|
| FreeType | C via Python | 2.13.3 | outline, metrics, coverage | FT_LOAD_NO_HINTING, FT_LOAD_NO_BITMAP, FT_LOAD_TARGET_NORMAL |
| freetype-py | Python | 2.5.1 | binding to the pinned FreeType | bound to the system 2.13.3 build |
| fontTools | Python | 4.55.3 | container, cmap, metrics | TTFont(lazy=True), getBestCmap() |
| golang.org/x/image/font/sfnt | Go | v0.23.0 | cmap, outline | none |
| skrifa / read-fonts | Rust | recorded in ORACLES.lock | outline, metrics | unhinted, default location |
| HarfBuzz / uharfbuzz | C via Python | 10.1.0 / 0.42.0 | cmap, outline | no shaping, no hinting |
| opentype.js | JavaScript | 1.3.4 | cmap, outline | none |
| Pillow | Python | 11.0.0 | coverage, advisory only | ImageFont.getmask |
| stb_truetype | C | 1.26 | coverage, advisory only | excluded from tolerance assertions |
| msdfgen | C++ | deferred | none in v0.1.0 | not pinned |
| moonfont.stdlib.reference | Python stdlib | 1.0.0 | six committed fixture categories | 8x8 uniform-grid supersampling, non-zero winding |
Pre-registered tolerances
Thresholds are fixed before any parity fixture is generated and may not be relaxed to make a failing test pass. Variant names and field labels are compared exactly before values; a missing field is a failure, never a default.
| Category | Rule |
|---|---|
| container | exact |
| cmap | exact |
| metrics, font units | exact |
| metrics, 26.6 | fixed_1 |
| outline, font units | exact |
| outline, 26.6 | fixed_1 |
| limits | exact |
| measurement | exact |
| coverage, 8-bit | coverage_8 |
| coverage, 1-bit | exact |
| error variants | exact |
fixed_1 allows one unit of 1/64 pixel per scalar. coverage_8 fixes width, height, left and top exactly, admits a per-sample difference of at most 32 for 99 per cent of samples, holds ink mass within 2 per cent, allows the ink box to differ by 1 pixel, and requires non-zero winding at sizes 8, 12, 16, 24, 32, 48 or 96.
The committed fixture toolchain adds three rules of its own: scaled bounds within 1 pixel, outline command streams exact after canonicalisation, and ink coverage within 5 per cent. Anti-aliasing is not bit-identical across rasterisers, so hinted glyphs are excluded entirely.
What is committed
Two corpora, distinguished by producer. The synthetic corpus is a deterministic byte constructor, not an oracle; the parity goldens are where another implementation supplies the answer.
6fixture categories: font, tables, cmap, metrics, outlines, coverage6glyphs and9tables insynthetic.ttf5codepoint-to-glyph-id mappings in a format 4cmap6outline streams and6coverage summaries8SHA-256 sidecars; 64 by 64 raster grid, 8 samples per axis- oracle
referenceversion 1.0.0, pure standard library - font digest
f2e72b1c3adcf15f61e20a333d8c05eab337cae30bdd6d3932eb510faad4c0b1
The hostile-input corpus in integration/difftest/corpus/manifest.json holds 39 cases: 34 refusals and 5 accepted files, of which 4 are legal but unusual. All nine Refused variants are exercised.
8Malformed,7MissingTable,6Truncated5OverLimit,2Unknown,2Unsupported2Recursion,1Unexpected,1MissingGlyph
A replay cell always carries a word — match, disagrees or refused — and a mono delta. CI replays committed fixtures on wasm, wasm-gc, js and native; it never calls an oracle.
Containers, outlines and instances
The second fixture set covers the formats a font arrives in and the tables that move it. Every expectation comes from fontTools, and every outline is cross-checked against FreeType before either is written down: the two must describe the same points, or generation stops.
| Fixture | What it exercises | Oracle |
|---|---|---|
| variable TrueType | two axes, shared and private point numbers, a composite whose components move | fontTools outlines, FreeType points |
| the same font as WOFF and WOFF2 | zlib per table; one Brotli stream with the glyf, loca and hmtx transforms | the plain file's own answers |
| hand-assembled CFF | hflex, a global and a local subroutine, a hint mask, a glyph width | fontTools, FreeType |
| CFF2 | blend driven by a variation store, built by varLib from two masters | fontTools at the default and at an instance |
| two-face collection | a shared table read through a .ttc and through a WOFF2 collection | both containers must agree |
| the variable font as a one-face collection | a transformed glyf reached through the collection directory | the single-font answers |
| metric variations | MVAR, VVAR, cvar over vhea, vmtx and cvt | fontTools' instancer at three locations |
Fixtures are produced offline by reference implementations written in other languages, committed to the repository as plain data, and replayed by MoonBit tests.
contracts/DIFFTEST.md, section 1.