Skip to main content

A tool for comparing font compiler outputs (fontc vs fontmake)

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttx_diff-0.2.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttx_diff-0.2.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file ttx_diff-0.2.1.tar.gz.

File metadata

  • Download URL: ttx_diff-0.2.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ttx_diff-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3fb562c7d7e62ec74ec993478d910d94c61972f9e5d658cf731974154186843b
MD5 1b85eb1bb5128f2b450fdf372f9f81b6
BLAKE2b-256 0273125a77cfc881d37cfa9b00e3b34fbb46f9663877999e1c9854f37b81dfa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttx_diff-0.2.1.tar.gz:

Publisher: python.yml on googlefonts/fontc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ttx_diff-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ttx_diff-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ttx_diff-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07a3eedf147f378341c9a64a6310c1f46f07f8d7cc5dc415a06c3031120937f7
MD5 5894ed1e0b2caa7874b1efdabae689ca
BLAKE2b-256 ab5b1f34c44b7f9dcccb422c4a2fbd91e8cf78ee99f1eac3f32ff20c59ccd0c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttx_diff-0.2.1-py3-none-any.whl:

Publisher: python.yml on googlefonts/fontc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page