• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 3 years ago
  • Updated 11 months ago

Reviews

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

Repository Details

Reading and writing font files

Fontations

This repo contains a number of foundational crates for reading and manipulating OpenType font files. It is motivated by a desire to have more robust and performant open tools for a variety of font engineering and production tasks. For an overview of the motivations, see googlefonts/oxidize.

structure

Currently, this repo contains three main library crates: font-types, read-fonts, and write-fonts, in addition to one binary crate, otexplorer:

  • font-types contains common definitions of the core types used in the OpenType spec. This is a small crate, and is intended as a basic dependency for any project reading or manipulating font data.
  • read-fonts contains code for parsing and accessing font files. It is intended to be a high performance parser, suitable for shaping. In particular this means that it performs no allocation and no copying.
  • write-fonts contains code for modifying and writing font data. It contains owned types representing the various tables and records in the specification, as well as code for compiling these and writing out font files. It has an optional dependency on read-fonts, in which case it can also parse font data, which can then be modified and written back out to disk.
  • otexplorer is a binary crate for exploring the contents of font files. It is developed as a debugging tool, and may also be useful as an example of how the read-fonts crate can be used.

codegen

Much of the code in the read-fonts and write-fonts crate is generated automatically. Code generation is performed by the font-codegen crate. For an overview of what we generate and how it works, see the codegen-tour. For an overview of how to use the font-codegen crate, see the readme at font-codegen/README.md.

contributing

We have included a few git hooks that you may choose to use to ensure that patches will pass CI; these are in resources/githooks.

If you would like to have these run automatically when you commit or push changes, you can set this as your git hooksPath:

git config core.hooksPath "./resources/githooks"

note: If you wish to use the hooks on macOS, install the gnu coreutils (brew install coreutils, via homebrew.)

releasing

We use cargo-release to help guide the release process. It can be installed with cargo install cargo-release. You may need to install pkg-config via your package manager for this to work.

Releasing involves the following steps:

  1. Determine which crates may need to be published: run cargo release changes to see which crates have been modified since their last release.

  2. Determine the new versions for the crates.

    • Before 1.0, breaking changes bump the minor version number, and non-breaking changes modify the patch number.
  3. Update manifest versions and release. ./resources/scripts/bump-version.sh orchestrates this process.

    • cargo release does all the heavy lifting
    # To see usage
    ./resources/scripts/bump-version.sh
    # To do the thing
    ./resources/scripts/bump-version.sh read-fonts write-fonts patch
  4. Commit these changes to a new branch, get it approved and merged, and switch to the up-to-date main.

  5. Publish the crates. ./resources/scripts/release.sh orchestrates the process.

    • You will be prompted to review changes along the way
    # To see usage
    ./resources/scripts/release.sh
    # To do the thing
    ./resources/scripts/release.sh read-fonts write-fonts

Skia and Chromium builds

An experimental SkTypeface implementation based on Fontations exists. This build is available in the Skia and Chromium repositories. The goal is to eventually use Fontations + Skia in Chromium as a memory-safe font backend. Tracking bugs: Skia, Chromium. To build the backends in Skia or Chromium follow the instructions below. This process is currently only tested on Linux.

Skia build

  1. Download Skia https://skia.org/docs/user/download/, including bazelisk
  2. $ bazelisk build --sandbox_base=/dev/shm --with_fontations //tools/viewer //tests:FontationsTest (to build debug, add -c dbg after build)
    • You should now have executables at bazel-bin/tests/FontationsTest and bazel-bin/tools/viewer/viewer

Skia Fontations unit tests

Build as above, then run the executable to run tests:

$ bazel-bin/tests/FontationsTest

OR compile and test in one command:

$ bazelisk test --sandbox_base=/dev/shm --with_fontations //tests:FontationsTest

Skia Fontations GM

Build as above then:

$ bazel-bin/tools/viewer/viewer --slide GM_typeface_fontations_roboto

OR build and run in one command:

$ bazelisk run --sandbox_base=/dev/shm --with_fontations //tools/viewer -- --slide GM_typeface_fontations_roboto

chromium build

  1. Follow the instructions for getting and building Chromium
  2. Add use_typeface_fontations = true to your args.gn using $ gn args out/<builddir>
  3. Build Chromium using autoninja -C out/<builddir> chrome
  4. Run Chromium using $ out/<builddir>/chrome
  5. Go to chrome://flags/#enable-fontations-backend and activate the flag, restart Chrome.
  6. Navigate to any URL, observe web fonts being displayed with Fontations + Skia path rendering.

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

fontmake

Compile fonts from sources (UFO, Glyphs) to binary (OpenType, TrueType).
Python
763
star
5

morisawa-biz-ud-gothic

Python
615
star
6

compute-shader-101

Sample code for compute shader 101 training
Rust
515
star
7

morisawa-biz-ud-mincho

Python
471
star
8

fontra

A browser-based font editor
JavaScript
463
star
9

roboto-flex

HTML
434
star
10

sfntly

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

amstelvar

a parametric variable font by David Berlow
330
star
12

fontview

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

spacemono

Original monospace display typeface family
318
star
14

decovar

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

gftools

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

nanoemoji

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

opensans

Open Sans font
Shell
221
star
18

literata

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

dm-fonts

DM Sans, DM Serif
Shell
190
star
20

rubik

Rubik fonts
Shell
182
star
21

glyphsLib

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

korean

Google Fonts Korean showcase
JavaScript
161
star
23

atkinson-hyperlegible

HTML
157
star
24

ufo2ft

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

roboto-classic

Development of a Roboto Variable font
Python
151
star
26

science-gothic

Science Gothic, a libre variable font
Python
145
star
27

picosvg

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

fontdiff

tool for finding visual differences between two font versions
C++
135
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