1 unstable release

new 0.1.1 Apr 23, 2025

#254 in Programming languages

40 downloads per month

MIT/Apache

265KB
6K SLoC

fontc_crater

The fontc_crater crate (named after rust-lang/crater) is a tool for performing compilation and related actions across a large number of source fonts.

Discovery of font sources is managed by a separate tool, google-fonts-sources; this tool checks out the github.com/google/fonts repository and looks for fonts with known source repos. You can use the --fonts-repo argument to pass the path to an existing checkout of this repository, which saves time.

Once sources are identified, they are checked out into a cache directory, where they can be reused between runs.

CI

This tool is mainly used in CI. In that case, the execution is managed by a script in the fontc_crater repo and results are posted to github pages.

To run in CI mode locally to play with the html output:

When run in CI, we want to ensure that we have complete control over the set of python pacakges we are comparing against; to ensure this we use pip-compile (part of pip-tools) to generate a pinned requirements.txt from a requirements.in file in the root resources/scripts directory.

To update the set of python packages in use, you need to update this file:

# Make sure you have pip-tools
$ python -m pip install pip-tools

# Rebuild the file
# Remove it to force a complete update rather than minimal
$ rm -f resources/scripts/requirements.txt && pip-compile resources/scripts/requirements.in

# Commit updated file

To run locally to rebuild the HTML:

# clone git@github.com:googlefonts/fontc_crater.git somewhere, we'll assume at ../fontc_crater
# CI currently has it's own format for the repo list, use the file from ^

$ cargo run --release -p=fontc_crater -- ci ../fontc_crater/targets.json -o ../fontc_crater/results/ --html-only

# Review ../fontc_crater/results/index.html (NOT ../fontc_crater/index.html)

To do a full run locally, such as to test a PR (assuming same fontc_crater checkout as above):

# make sure the repo is up to date, so you're comparing against the latest run:
# cd ../fontc_crater && git pull

$ RUST_LOG=debug cargo run --release -p fontc_crater \
-- ci ../fontc_crater/targets.json --out ../fontc_crater/results/

Dependencies

~36–50MB
~1M SLoC