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

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.0.tar.gz (22.6 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.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ttx_diff-0.2.0.tar.gz
  • Upload date:
  • Size: 22.6 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.0.tar.gz
Algorithm Hash digest
SHA256 8874860072b438343d8ac0f2a1b8a041a7fb26c595038e4293d0ddaa3d26bbe2
MD5 1601afe1fa523dc5f218a69be583d04b
BLAKE2b-256 5ab04f5155d40b7a608ea2ab26888ecae1691013c9a2af65394839f9838f6091

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttx_diff-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: ttx_diff-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d14c4289b005d4e469565a5af54f5e6580d0dcefba86f1ca16b2d9218fb967b
MD5 4ae93c3de483665f382ee8dbd1ad7763
BLAKE2b-256 b24167cc76d30afec24a885d8c90381732088ab2816ed0810c15feea4d97f9d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ttx_diff-0.2.0-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