googlefonts / fontmake

Compile fonts from sources (UFO, Glyphs) to binary (OpenType, TrueType).
Apache License 2.0
784 stars 93 forks source link

GitHub Actions Build Status Python Versions ![PyPI Version][]

fontmake

fontmake compiles fonts from various sources (.glyphs, .ufo, designspace) into binaries (.otf, .ttf). You can use it to create static instances and variable fonts.

Installation

Fontmake requires Python 3.8 or later.

Releases are available on PyPI and can be installed with pip.

pip3 install fontmake

Use the -U, --upgrade option to update fontmake and its dependencies to the newest available release:

pip3 install -U fontmake

Basic Usage

After installation, you will be able to use the fontmake executable.

For example, to compile a variable font from a Glyphs source file, use:

fontmake MyFont.glyphs -o variable

The most important command line arguments to the fontmake executable are the required input, specified either as positional argument or using one of -g/-u/-m flags, and the optional -o flag, which chooses the output file format.

Source file format options

There are two ways to specify the source file or files:

One can either use the following, mutually exclusive, flags:

Alternatively, one can specify the input(s) as positional arguments without the flag, letting fontmake infer the source format from the file extension: e.g. fontmake MyFont.designspace, etc.

Note: if the positional arguments are preceded by an option that takes one or more arguments, you need to use the special -- separator to mark all following arguments as positional (non-options), otherwise the parser gets confused. E.g., the -i option takes zero or one arguments (see futher below for details); without --, argparse thinks you didn't provide any inputs:

fontmake -i -- MyFont.designspace

Exactly one type of input can/must be specified, using either approaches.

Output file format options

You may provide one or more output file formats after the -o option. For example, -o otf ttf creates OTF and TTF binary font files for each master in your input file.

The following output file formats are available:

The following output file formats are also available, but are generally used internally by fontmake as an intermediate step to one of the above outputs:

If no format option is specified, the default is -o otf ttf.

Other important command line options

Advanced Usage

See USAGE.md.

Troubleshooting

See TROUBLESHOOTING.md.

Developers

Developers can get the latest version of fontmake by cloning the git repository:

git clone https://github.com/googlefonts/fontmake
cd fontmake
pip install .

Developers who want to quickly test changes to the source code without re-installing can use the "--editable" option when installing from a local source checkout:

pip install -e .

It is recommended to install fontmake inside a virtual environment to prevent conflicts between its dependencies and other modules installed globally.

You could also use the pipx tool to automate the installation/upgrade of python apps like fontmake in isolated environments.

Releasing a New Version

  1. Commit and push your final changes for the new version.
  2. Create an annotated Git tag of the version number, with a prepended "v", like so: git tag -a v3.1.1
  3. Write the release notes into the tag message. They will show up as release notes on the release page in GitHub.
  4. Push the tag like so: git push origin v3.1.1, where origin is the name of the usual remote you want to push the version to.