Font developers are expected to understand the following:
bash).pip, and virtual environments.cd, ls, mv, cp.See the useful links section at the bottom of this page to bring you up to speed.
Note: If you are not familiar with the concepts listed above, and do not wish to learn about them, we recommend you to try following the GitHub repository requirements as closely as possible, as well as the font file requirements, and a GF Team Member will help you with the tooling and building process of your font.
Most of these tools are Python-based (Fontspector, our QA tool, is a standalone program written in Rust), but you may need to install some other tools before. Specifics for every OS can’t be detailed here; therefore, it is your responsibility to search the Internet to find the right way to install and use these tools according to your own environment.
To work with Google Fonts, you would need to install at least:
A shell is a computer program that makes it possible to interact with an operating system and often is accessible through a text interface, the command-line. The most common shells are the Bourne Again Shell (known as Bash) and Zsh (an extended Bash). The built-in command-line prompts to run the commands are Terminal in OS X and CMD in Windows. You will need it to install the required tools.
A terminal prompt often looks like this:
YourUserName:~$
~ being the root of the user directory.
$ a customizable command prompt, which also indicates your type of shell ($ is the default for bash)
Homebrew is a package manager for Unix utilities that you can use in macOS so you can install some utilities safely. It uses its own directory to install the packages without messing with the native files of the operative system.
Install Homebrew, and don’t forget to run the two commands at the end of the installation, which will set your PATH environment variable.
On macOS, you will need the Apple developer tools: either XCode, which is optional and requires a lot of space (~20Gb) or the light version of it, the Command Line Tools. These tools are needed to install the GCC (GNU Compiler Collection). Homebrew is supposed to install the XCode Command Line Tools directly, so at this stage, check if it successfully installed them by running: xcode-select -p.
Typically, a version of Python is already installed with the Operating System. However, in some cases, this could be still version 2. GF tools requires at least version 3.10.
You can verify which Python version is installed by running: python --version. You may find Python 3 under python3 --version. (Same applies for pip/pip3)
If you already find a Python 3 version installed, you could first confirm its location by running which python. The resulting path will help identify whether it was installed using Homebrew or from the package downloaded from the Python site and so you can consult the best way to update it if needed.
There are many implementations of Python. CPython is the reference one written in C, which provides a high level of compatibility with Python packages. PyPy is an interpreter focused on optimization as it runs generally faster, but it does not guarantee compatibility with all Python packages, so we recommend using the former.
To install the CPython implementation:
brew install python
Install Certificates.command and Update Shell Profile.command to add the python path to your bash profile.Installing python usually comes with pip (the standard package manager for Python), allowing you to install and uninstall or freeze the packages. If you work on Mac with an Apple M1 chip, you must first upgrade pip to the latest version using pip install --upgrade pip.
It is strongly suggested to create and work under a Python Virtual Environment. This allows you to install and manage packages and modules in an isolated directory for a particular project instead of installing them globally (as part of a system-wide Python). Doing this stops you from creating conflicts with the global site-packages directory (Operating System version) while allowing you to use specific versions of packages for a given project.
To create a virtual environment, go to the directory where you want to install it and run the command:
python3 -m venv myenv
The last part of the command is the name you want to give to the virtual environment. Usually, it is only venv, or myenv if you specifically want to differentiate it from the Python Module “venv” name.
Once you have created your virtual environment, you need to activate it.
On Unix or macOS run:
source myenv/bin/activate
On Windows:
myenv\Scripts\activate.bat
After you have activated the virtual environment, the command prompt will display the name of the virtual environment that you are using in parentheses:
(myenv) userName directoryName $
To deactivate the virtual environment, just type deactivate. Just so you know, closing the Terminal window will also deactivate the environment, and you will have to reactivate it every time you want to work on your project.
You can install as many virtual environments as you want; in each project directory or your user home directory if you intend to use the same virtual environment for all your projects. Command-line tools often have settings to run a command automatically when a new window opens; you could activate one virtual environment this way and avoid having to type it every time.
It is not recommended to install virtual environments in clouds, drives, Dropbox, etc.
Once you have installed Python, and created and activated your virtual environment, you can install the required tools to produce and test your fonts for Google Fonts.
A requirements.txt file listing all the needed tools and dependencies to run a project is required for each project. If you already have one, you can install all the listed tools in it by running one command:
pip install -r requirements.txt
Fontspector is the quality assurance (QA) testing tool used by Google Fonts. It runs a series of checks on the technical correctness of the exported fonts based on a vendor’s profile. It is a Rust port of Fontbakery, the Python tool previously used by Google Fonts, and it is much faster. You can find more documentation about it in the GitHub repository fonttools/fontspector.
Unlike the other tools on this page, Fontspector is not a Python package, so it is not installed with pip or listed in your requirements.txt file. It is distributed as a single executable file which contains all the checks and profiles.
If you only want to check a few fonts, you don’t need to install anything: the web version of Fontspector provides almost all the features of the command-line tool. It runs entirely in your browser, and your fonts are not uploaded anywhere.
To install the command-line tool, you can either:
aarch64-apple-darwin for Apple Silicon Macs, x86_64-apple-darwin for Intel Macs, x86_64-pc-windows-gnu for Windows, x86_64-unknown-linux-gnu for Linux). Unpack the archive and move the fontspector file into a directory listed in your PATH (for example /usr/local/bin/ or ~/bin on macOS and Linux; run echo $PATH to see these directories).Or download and install it with cargo-binstall (which can be installed with brew install cargo-binstall on macOS):
cargo-binstall fontspector
To check that everything is working, run fontspector --list-checks, which should output the list of available checks, and fontspector --help to get an overview of the usage of the tool.
On macOS, a downloaded binary may be blocked the first time because it is not code-signed (“fontspector can’t be opened because it is from an unidentified developer”). In this case, open System Settings > Privacy & Security and click on “Open Anyway” next to the message about fontspector. You only need to do this once.
More details, including how to build Fontspector from source, are available in its installation guide. The usage of Fontspector for Google Fonts is described in the QA section of this Guide.
gftools is a collection of scripts and tools to modify, build and package fonts for Google Fonts. You can find more documentation about them in the GitHub repository googlefonts/gftools.
To install gftools run the command:
pip install gftools
Run the command gftools --help to overview all the scripts and their usage.
gftools qa is a tool intended for more experienced users that wraps several font QA tools: Fontspector (with the googlefonts profile), Diffenator3 (diffenator3 and diff3proof) and an interpolation checker. It allows to check fonts against a version already distributed by Google Fonts and create HTML pages to proof the fonts in different browsers.
gftools qa calls these tools from the command line, so the fontspector, diffenator3 and diff3proof executables need to be installed and available in your PATH:
diffenator3 and diff3proof from the latest Diffenator3 release and place them in your PATH, as for Fontspector.The interpolation checks need pkg-config and Cairo, which can be installed with Homebrew on macOS:
brew install cairo pkg-config
Finally, you can install gftools qa:
pip install 'gftools[qa]'
Run the command gftools qa --help to have an overview of the tool and its options, and see the QA section for its usage.
The bash profile (or z profile according to your shell script), is loaded before your Command Line Interface (CLI) loads your shell environment and contains all the startup configuration and preferences for your CLI. In macOS, the file is hidden (starts with a .) in your home directory. You can display the hidden files (cmd+shift+. in the Finder) and open the file in a code editor. Otherwise, check on the Internet how to find and edit it.
Once you have set up git and all the other tools, your bash profile (or z profile according to your shell script) should look like this:
# PATH for Python3
PATH="path/to/python3/directory:${PATH}"
export PATH
# PATH for homebrew
eval "$(path/to/homebrew/directory shellenv)"
# GITHUB TOKEN
export GH_TOKEN="your_github_token_here"