Skip to main content

ttx-diff

PyPI Python Version

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.

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
  • fontc and otl-normalizer binaries (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:

  1. Specify paths explicitly (recommended for most users):

    ttx-diff --fontc_path /path/to/fontc --normalizer_path /path/to/otl-normalizer source.glyphs
    
  2. Add them to your PATH: If fontc and otl-normalizer are in your PATH, they'll be found automatically

  3. 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

Releasing

See https://googlefonts.github.io/python#make-a-release.

Release files for ttx-diff 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ttx-diff 0.2.1
File Size Uploaded
ttx_diff-0.2.1.tar.gz 23.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ttx-diff 0.2.1
File Interpreter ABI Platform
ttx_diff-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.6 kB

Release files / ttx_diff-0.2.1.tar.gz

Download URL ttx_diff-0.2.1.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3fb562c7d7e62ec74ec993478d910d94c61972f9e5d658cf731974154186843b
BLAKE2b-256 checksum
How to use checksums
0273125a77cfc881d37cfa9b00e3b34fbb46f9663877999e1c9854f37b81dfa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2025.

Transparency log

Release files / ttx_diff-0.2.1-py3-none-any.whl

Download URL ttx_diff-0.2.1-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07a3eedf147f378341c9a64a6310c1f46f07f8d7cc5dc415a06c3031120937f7
BLAKE2b-256 checksum
How to use checksums
ab5b1f34c44b7f9dcccb422c4a2fbd91e8cf78ee99f1eac3f32ff20c59ccd0c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page