ttx-diff
March 11, 2026 ยท View on GitHub
A tool for comparing font compiler outputs between fontc (Rust) and fontmake (Python).
Overview
ttx-diff is a helper utility that compares binary font outputs from two different font compilers:
- fontc: The Rust-based font compiler from Google Fonts
- fontmake: The Python-based font compiler
The tool converts each binary font to TTX (XML) format, normalizes expected differences, and provides a detailed comparison summary.
Note that ttx_diff is a pure Python package (located in src/ttx_diff/)
rather than a typical Rust crate within this workspace.
Installation
From PyPI
pip install ttx-diff
From source
git clone https://github.com/googlefonts/fontc.git
cd fontc/ttx_diff
pip install -e .
Requirements
- Python 3.10 or higher
fontcandotl-normalizerbinaries (see below)
All Python dependencies (fontmake, fonttools, etc.) are installed automatically.
Getting fontc and otl-normalizer
The tool needs the fontc and otl-normalizer binaries. You can:
-
Specify paths explicitly (recommended for most users):
ttx-diff --fontc_path /path/to/fontc --normalizer_path /path/to/otl-normalizer source.glyphs -
Add them to your PATH: If
fontcandotl-normalizerare in your PATH, they'll be found automatically -
Run from fontc repository: If you run from the fontc repository root, the tool will automatically build the binaries for you
Usage
Note: Unlike the original ttx_diff.py script, this standalone version can be run from any directory. You don't need to be in the fontc repository.
Rebuild with both fontmake and fontc and compare:
ttx-diff --fontc_path /path/to/fontc --normalizer_path /path/to/otl-normalizer path/to/source.glyphs
If the binaries are in your PATH:
ttx-diff path/to/source.glyphs
Compare two precompiled fonts directly (without building from source):
ttx-diff --fontc_font path/to/fontc.ttf --fontmake_font path/to/fontmake.ttf
This is useful for comparing font differences when you already have both builds.
Rebuild only fontc's font and reuse existing fontmake output:
ttx-diff --rebuild fontc path/to/source.glyphs
Output results in machine-readable JSON format, as used by the fontc_crater tool.
ttx-diff --json path/to/source.glyphs
Compare using gftools build pipeline:
ttx-diff --compare gftools --config config.yaml path/to/source.glyphs
Development
Running tests
pip install -e .[test]
pytest
Running tests with coverage
pytest --cov=ttx_diff --cov-report=html