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.

moonfont reference oracle
A kerning pair in the proofreader's sense: the same 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.
Cross-language oracle assignment. Versions are the pins recorded in contracts/DIFFTEST.md, section 5; a version bump is a one-way door that invalidates every committed golden.
Library Language Pinned version Authoritative for Flags
FreeTypeC via Python2.13.3outline, metrics, coverageFT_LOAD_NO_HINTING, FT_LOAD_NO_BITMAP, FT_LOAD_TARGET_NORMAL
freetype-pyPython2.5.1binding to the pinned FreeTypebound to the system 2.13.3 build
fontToolsPython4.55.3container, cmap, metricsTTFont(lazy=True), getBestCmap()
golang.org/x/image/font/sfntGov0.23.0cmap, outlinenone
skrifa / read-fontsRustrecorded in ORACLES.lockoutline, metricsunhinted, default location
HarfBuzz / uharfbuzzC via Python10.1.0 / 0.42.0cmap, outlineno shaping, no hinting
opentype.jsJavaScript1.3.4cmap, outlinenone
PillowPython11.0.0coverage, advisory onlyImageFont.getmask
stb_truetypeC1.26coverage, advisory onlyexcluded from tolerance assertions
msdfgenC++deferrednone in v0.1.0not pinned
moonfont.stdlib.referencePython stdlib1.0.0six committed fixture categories8x8 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.

Per-category rules from contracts/DIFFTEST.md, section 6.
CategoryRule
containerexact
cmapexact
metrics, font unitsexact
metrics, 26.6fixed_1
outline, font unitsexact
outline, 26.6fixed_1
limitsexact
measurementexact
coverage, 8-bitcoverage_8
coverage, 1-bitexact
error variantsexact

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.

  • 6 fixture categories: font, tables, cmap, metrics, outlines, coverage
  • 6 glyphs and 9 tables in synthetic.ttf
  • 5 codepoint-to-glyph-id mappings in a format 4 cmap
  • 6 outline streams and 6 coverage summaries
  • 8 SHA-256 sidecars; 64 by 64 raster grid, 8 samples per axis
  • oracle reference version 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.

  • 8 Malformed, 7 MissingTable, 6 Truncated
  • 5 OverLimit, 2 Unknown, 2 Unsupported
  • 2 Recursion, 1 Unexpected, 1 MissingGlyph

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.

Format fixtures and what each one is for
FixtureWhat it exercisesOracle
variable TrueTypetwo axes, shared and private point numbers, a composite whose components movefontTools outlines, FreeType points
the same font as WOFF and WOFF2zlib per table; one Brotli stream with the glyf, loca and hmtx transformsthe plain file's own answers
hand-assembled CFFhflex, a global and a local subroutine, a hint mask, a glyph widthfontTools, FreeType
CFF2blend driven by a variation store, built by varLib from two mastersfontTools at the default and at an instance
two-face collectiona shared table read through a .ttc and through a WOFF2 collectionboth containers must agree
the variable font as a one-face collectiona transformed glyf reached through the collection directorythe single-font answers
metric variationsMVAR, 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.