• Stars
    star
    763
  • Rank 59,519 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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:

  • -g filename.glyphs: Converts a Glyphs source file to binary.
  • -u filename.ufo ...: Converts one or more UFO(Z) 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, or to UFO zip (.ufoz) format with the flag --save-ufo-as-zip. 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.

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.

More Repositories

1

roboto

The Roboto family of fonts
Python
3,796
star
2

noto-emoji

Noto Emoji fonts
Python
3,331
star
3

Inconsolata

Development repo of Inconsolata Fonts by Raph Levien
Rust
1,201
star
4

morisawa-biz-ud-gothic

Python
615
star
5

compute-shader-101

Sample code for compute shader 101 training
Rust
515
star
6

morisawa-biz-ud-mincho

Python
471
star
7

fontra

A browser-based font editor
JavaScript
463
star
8

roboto-flex

HTML
434
star
9

sfntly

A Library for Using, Editing, and Creating SFNT-based Fonts
Java
432
star
10

amstelvar

a parametric variable font by David Berlow
330
star
11

fontview

Demo app that displays fonts with a free/libre/open-source text rendering stack: FreeType, HarfBuzz and Raqm
C++
321
star
12

spacemono

Original monospace display typeface family
318
star
13

decovar

A multistyle decorative variable font by David Berlow
Python
314
star
14

gftools

Misc tools for working with the Google Fonts library
Python
242
star
15

nanoemoji

A wee tool to build color fonts.
Python
239
star
16

opensans

Open Sans font
Shell
221
star
17

literata

A contemporary serif typeface family for long-form reading
Python
219
star
18

dm-fonts

DM Sans, DM Serif
Shell
190
star
19

rubik

Rubik fonts
Shell
182
star
20

glyphsLib

A bridge from Glyphs source files (.glyphs) to UFOs
Python
181
star
21

korean

Google Fonts Korean showcase
JavaScript
161
star
22

atkinson-hyperlegible

HTML
157
star
23

ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
Python
151
star
24

roboto-classic

Development of a Roboto Variable font
Python
151
star
25

science-gothic

Science Gothic, a libre variable font
Python
145
star
26

picosvg

Helps simplify SVG files. Intended for use as part of a font build.
Python
137
star
27

fontdiff

tool for finding visual differences between two font versions
C++
135
star
28

fontations

Reading and writing font files
Rust
114
star
29

pyfontaine

Python tool to check font files for language/character set support
Python
100
star
30

gf-docs

Documentation for things related to github.com/google/fonts
99
star
31

color-fonts

Experimental color font builds.
Python
96
star
32

googlefonts-project-template

(DEMO) Repository architecture example for a typeface design project
Python
93
star
33

inter-gf-tight

Specialized version of Inter with tighter spacing, for use by Google Workspace
Python
79
star
34

glyphsets

Python
78
star
35

fontdiffenator

Font comparison tool
Python
76
star
36

dm-mono

DM Mono
Shell
73
star
37

lexend

A variable font family designed to aid in reading proficiency.
Shell
72
star
38

zen-marugothic

ZenFonts.jp Maru Gothic
Python
72
star
39

fontcrunch

Tool to optimize TrueType font splines
C++
70
star
40

RobotoMono

Shell
64
star
41

colr-gradients-spec

HTML
63
star
42

cu2qu

Cubic-to-quadratic bezier curve conversion
Python
62
star
43

fontreport

Tool to create PDF files containing glyph images and information about a font.
Python
62
star
44

googlefonts.github.io

Google Fonts documentation
CSS
57
star
45

robotoslab

Roboto Slab Typeface by Google
Python
57
star
46

roboto-serif

55
star
47

tajawal

Distinctive low contrast Arabic and sans serif Latin typeface family
54
star
48

emoji-metadata

Emoji metadata for the construction of pickers
48
star
49

dosis-vf

Fork of Dosis
Makefile
45
star
50

oxidize

Notes on moving tools and libraries to Rust.
45
star
51

zen-kurenaido

ZenFonts.jp Kurenaido
Python
45
star
52

comfortaa

Open-source font by Johan Aakerlund
HTML
44
star
53

diffenator2

A font comparison tool that will not stop until your fonts are exhaustively compared.
Python
43
star
54

ibarrareal

Ibarra Real Fonts
Shell
40
star
55

zen-kakugothic

ZenFonts.jp Kaku Gothic
Python
40
star
56

Gulzar

Nastaliq font
Python
39
star
57

gulim

Python
39
star
58

how-to-hint-variable-fonts

A how-to guide to TrueType hinting variable fonts, with VTT
38
star
59

NunitoSans

Shell
36
star
60

zen-oldmincho

ZenFonts.jp Old Mincho
Python
36
star
61

fontra-pak

A cross-platform bundled Fontra server for local desktop use
Python
34
star
62

TachyFont

Lazily loaded web fonts.
JavaScript
34
star
63

majormono

Python
32
star
64

josefinsans

Google Improvement Project
HTML
31
star
65

shaperglot

Test font files for language support
Python
30
star
66

EQX

A typographically centric font testing tool.
JavaScript
29
star
67

fontbakery-dashboard

A library-scale web dashboard for Font Bakery, no longer developed
JavaScript
28
star
68

axisregistry

A Python API to access data from the Google Fonts variable fonts Axis Registry.
Python
27
star
69

karla

Python
25
star
70

fontmake-rs

Where in we pursue oxidizing (context: https://github.com/googlefonts/oxidize) fontmake.
Rust
24
star
71

chws_tool

Add OpenType chws/vchw features to fonts.
HTML
23
star
72

lang

A python API for evaluating language support in the Google Fonts collection.
Python
23
star
73

caveat

Caveat handwriting fonts
Shell
23
star
74

compreffor

A CFF table subroutinizer for FontTools
Python
23
star
75

kosugi-maru

Kosugi Maru fonts, originally by Motoya
Python
23
star
76

collidoscope

Brute force detection of glyph collisions
Python
22
star
77

zen-antique

ZenFonts.jp Antique
Python
21
star
78

questrial

A fork of John Prince font Questrial from the old Google font directory
Python
21
star
79

chinese

CSS
20
star
80

gf-glyphs-scripts

Scripts for Glyphs
Python
20
star
81

staatliches

Herbert Bayer’s title lettering for the first Bauhaus exhibition catalogue cover of 1923
Python
18
star
82

batang

Python
18
star
83

changa-vf

Variable font fork of the Changa typeface (Latin, Arabic)
Makefile
17
star
84

Roboto-Delta

Roboto as a “parametric” Variable Font
Python
17
star
85

picosvg-rs

A Rust version of picosvg.
Rust
15
star
86

silkscreen

Classic web design pixel font from Jason Kottke, 2001
Python
15
star
87

gfregression

Test local fonts against fonts host on fonts.google.com
Python
14
star
88

fez

Font Engineering made eaZy
Python
14
star
89

mavenproFont

Maven Pro family by Joe Prince
Makefile
14
star
90

BethEllen

Font project repo for the Beth Ellen font by Rod Jelinski
14
star
91

fontquant

Prove and quantify a font’s technical quality
Python
11
star
92

how-to-hint-complex-script-variable-fonts

A guide to hinting complex script variable fonts with Visual TrueType
11
star
93

ufomerge

ufomerge
Python
11
star
94

dynapuff

Fun blobby display font
Python
10
star
95

kosugi

Kosugi fonts, originally by Motoya
Python
10
star
96

zen-dots

Shell
10
star
97

flowify

Turn a font into a flow font
Python
10
star
98

namecheck

Python
9
star
99

ots-python

Python wheels for the OpenType Sanitizer
Python
9
star
100

variable-components-spec

8
star