Skip to main content

Compile fonts from sources (UFO, Glyphs) to binary (OpenType, TrueType).

Project description

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.7 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:

  • -g filename.glyphs: Converts a Glyphs source file to binary.
  • -u filename.ufo ...: Converts one or more UFO files to binary.
  • -m filename.designspace: Converts a Designspace file to binary. (The -m is for mutatormath, an old Python library for handling designspaces.)

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:

  • otf: Per-master OTF (CFF-outline) binaries. Placed in the master_otf/ directory.
  • ttf: Per-master TTF (TrueType-outline) binaries. Placed in the master_ttf/ directory.
  • otf-cff2: Per-master OTF binaries with CFF2 outlines. Placed in the master_otf/ directory.
  • variable: A TrueType variable font. Placed in the variable_ttf/ directory.
  • variable-cff2: A variable font with CFF2 outlines. Placed in the variable_otf/ directory.

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:

  • otf-interpolatable: OTF binaries suitable for merging into a variable font. Placed in the master_otf_interpolatable/ directory. (These differ from otf in that the outlines are unoptimized.)
  • ttf-interpolatable: TTF binaries suitable for merging into a variable font. Placed in the master_ttf_interpolatable/ directory. (The outlines are converted to quadratic curves in an interpolation-compatible way.)
  • ufo: Glyphs sources can be converted to UFO. Placed in the master_ufo/ directory.

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

Other important command line options

  • -i (Interpolate instances): Having per-master binaries is not always what you expect; if you have defined instances ("exports") in your Glyphs file, they will not be generated by default. To generate them, pass the -i flag, which interpolates static instances, and places them in the instance_ttf/ or instance_otf/ directory as appropriate.

  • --output-dir <some_directory>: Places all output in the given directory, instead of the per-format directories mentioned above.

  • --output-path <filename>: This is only valid if the output is a single binary file, and writes the output to the given filename.

  • -f (Flatten components): Ensures that any glyphs which contain components which themselves contain components are decomposed to a single level. This is recommended as certain rendering environments do not correctly handle nested components - see this link for more details.

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.

Project details


Release history Release notifications | RSS feed

This version

3.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fontmake-3.0.0.zip (319.0 kB view details)

Uploaded Source

Built Distribution

fontmake-3.0.0-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file fontmake-3.0.0.zip.

File metadata

  • Download URL: fontmake-3.0.0.zip
  • Upload date:
  • Size: 319.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for fontmake-3.0.0.zip
Algorithm Hash digest
SHA256 864983cb636c739d73dc859f0518a7480cecdd061e2b3484e1b457b5db7ecaae
MD5 a30347be3d893b8b2d2521c22edc6df4
BLAKE2b-256 c1bd4860ca99b1e5968930eeba5f88ae2a1007ab7d1b2cbdc9e3e0ff5c6ea7e9

See more details on using hashes here.

Provenance

File details

Details for the file fontmake-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: fontmake-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for fontmake-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f854b324c861bafe4eb6b025e844dee0697c855cf8b7ad864cb0267ffb70c7c
MD5 9282568e148ac706c527af3c96961785
BLAKE2b-256 087b34d0fc67c4caacfdc47d0c996b18ba61927054274bf7541e24d5e3eb0b72

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page