| 1 | [](https://github.com/googlefonts/gftools/actions/workflows/ci.yml?query=workflow%3ATest+branch%3Amain) |
| 2 | [](https://pypi.org/project/gftools/) |
| 3 | |
| 4 | # Google Fonts Tools |
| 5 | |
| 6 | This project contains tools used for working with the Google Fonts collection, plus **Google Fonts Glyph Set Documentation** in the [/encodings](https://github.com/googlefonts/gftools/tree/main/Lib/gftools/encodings) subdirectory. While these tools are primarily intended for contributors to the Google Fonts project, anyone who works with fonts could find them useful. |
| 7 | |
| 8 | Additional documentation in [`/docs`](https://github.com/googlefonts/gftools/blob/main/docs) |
| 9 | |
| 10 | The tools and files under this directory are available under the Apache License v2.0, for details see [LICENSE](LICENSE) |
| 11 | |
| 12 | ## Google Fonts Official Glyph Sets |
| 13 | |
| 14 | The glyph sets useful for type designers that were previously hosted in this repository have been moved to: |
| 15 | |
| 16 | <https://github.com/googlefonts/glyphsets/tree/main/GF_glyphsets> |
| 17 | |
| 18 | ## Tool Usage Examples |
| 19 | |
| 20 | Compare fonts: |
| 21 | |
| 22 | gftools compare-font font1.ttf font2.ttf |
| 23 | |
| 24 | Add a METADATA.pb to a family directory |
| 25 | |
| 26 | gftools add-font ../ofl/newfamily |
| 27 | |
| 28 | Sanity check a family directory: |
| 29 | |
| 30 | gftools sanity-check --repair_script=/tmp/fix.py ../ofl/josefinsans |
| 31 | gftools sanity-check --repair_script=/tmp/fix.py --fix_type=fsSelection ../ufl |
| 32 | |
| 33 | Check a font family against the same family hosted on Google Fonts: |
| 34 | |
| 35 | gftools qa [fonts.ttf] -gfb -a -o qa |
| 36 | |
| 37 | Check a variable font family against the same family as static fonts: |
| 38 | |
| 39 | gftools qa -f [vf_fonts] -fb [static_fonts] --diffenator --diffbrowsers -o ~/path/out |
| 40 | |
| 41 | Fix a non hinted font |
| 42 | |
| 43 | gftools fix-nonhinting font_in.ttf font_out.ttf |
| 44 | |
| 45 | Package and PR a family update to google/fonts. Find much more detailed [documentation in `/docs/gftools-packager`](./docs/gftools-packager). |
| 46 | |
| 47 | gftools packager "Family Sans" path/to/local/google/fonts -py |
| 48 | |
| 49 | ## Tool Installation |
| 50 | |
| 51 | **Please note that gftools requires [Python 3.7](http://www.python.org/download/) or later.** |
| 52 | |
| 53 | Please install these tools using pip: |
| 54 | |
| 55 | pip install gftools |
| 56 | |
| 57 | If you would like to use `gftools qa`: |
| 58 | |
| 59 | brew install pkg-config # needed for interpolation checks |
| 60 | pip install 'gftools[qa]' |
| 61 | |
| 62 | |
| 63 | ### Tool Requirements and Dependencies |
| 64 | |
| 65 | `gftools packager` needs the command line `git` program in a version >= Git 2.5 (Q2 2015) in order to perform a shallow clone (`--depth 1`) of the font upstream repository and branch. This is not supported by pygit2/libgit2 yet. |
| 66 | |
| 67 | `gftools manage-traffic-jam` requires two private files which contain sensitive data. Ask m4rc1e for them. |
| 68 | |
| 69 | ### Google Fonts API Key |
| 70 | |
| 71 | In order to use the scripts **gftools qa** and **gftools family-html-snippet**, you will need to generate a Google Fonts api key, https://developers.google.com/fonts/. You will then need to create a new text file located on your system at `~/.gf-api-key` (where ~ is your home directory), which contains the following: |
| 72 | |
| 73 | ``` |
| 74 | [Credentials] |
| 75 | key = your-newly-generated-googlefonts-api-key |
| 76 | |
| 77 | ``` |
| 78 | |
| 79 | **Upstream project repos** |
| 80 | |
| 81 | * https://github.com/google/protobuf |
| 82 | * https://github.com/behdad/fonttools |
| 83 | |
| 84 | ## Developers |
| 85 | |
| 86 | ### Releasing a New Version |
| 87 | |
| 88 | 0. Commit and push your final changes for the new version. |
| 89 | 1. Create an annotated Git tag of the version number, with a prepended "v", like so: `git tag -a v3.1.1` |
| 90 | 2. Write the release notes into the tag message. They will show up as release notes on the release page in GitHub. |