• Stars
    star
    114
  • Rank 301,601 (Top 7 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated 7 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
738
star
5

morisawa-biz-ud-gothic

Python
605
star
6

compute-shader-101

Sample code for compute shader 101 training
Rust
497
star
7

morisawa-biz-ud-mincho

Python
461
star
8

roboto-flex

HTML
434
star
9

sfntly

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

fontra

A browser-based font editor
JavaScript
398
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++
319
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
241
star
16

nanoemoji

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

literata

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

opensans

Open Sans font
Shell
209
star
19

dm-fonts

DM Sans, DM Serif
Shell
187
star
20

rubik

Rubik fonts
Shell
182
star
21

glyphsLib

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

korean

Google Fonts Korean showcase
JavaScript
160
star
23

atkinson-hyperlegible

HTML
157
star
24

ufo2ft

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

roboto-classic

Development of a Roboto Variable font
Python
146
star
26

picosvg

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

fontdiff

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

science-gothic

Science Gothic, a libre variable font
Python
134
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

googlefonts-project-template

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

color-fonts

Experimental color font builds.
Python
91
star
33

inter-gf-tight

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

fontdiffenator

Font comparison tool
Python
76
star
35

dm-mono

DM Mono
Shell
73
star
36

glyphsets

Python
73
star
37

lexend

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

fontcrunch

Tool to optimize TrueType font splines
C++
68
star
39

zen-marugothic

ZenFonts.jp Maru Gothic
Python
66
star
40

RobotoMono

Shell
64
star
41

cu2qu

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

fontreport

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

colr-gradients-spec

HTML
61
star
44

robotoslab

Roboto Slab Typeface by Google
Python
57
star
45

googlefonts.github.io

Google Fonts documentation
CSS
54
star
46

tajawal

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

roboto-serif

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

comfortaa

Open-source font by Johan Aakerlund
HTML
44
star
52

zen-kurenaido

ZenFonts.jp Kurenaido
Python
44
star
53

ibarrareal

Ibarra Real Fonts
Shell
39
star
54

diffenator2

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

Gulzar

Nastaliq font
Python
38
star
56

zen-kakugothic

ZenFonts.jp Kaku Gothic
Python
36
star
57

zen-oldmincho

ZenFonts.jp Old Mincho
Python
36
star
58

how-to-hint-variable-fonts

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

TachyFont

Lazily loaded web fonts.
JavaScript
34
star
60

NunitoSans

Shell
33
star
61

majormono

Python
32
star
62

josefinsans

Google Improvement Project
HTML
31
star
63

fontra-pak

A cross-platform bundled Fontra server for local desktop use
Python
30
star
64

EQX

A typographically centric font testing tool.
JavaScript
29
star
65

fontbakery-dashboard

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

shaperglot

Test font files for language support
Python
27
star
67

axisregistry

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

fontmake-rs

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

caveat

Caveat handwriting fonts
Shell
23
star
70

compreffor

A CFF table subroutinizer for FontTools
Python
23
star
71

lang

A python API for evaluating language support in the Google Fonts collection.
Python
22
star
72

collidoscope

Brute force detection of glyph collisions
Python
22
star
73

karla

Python
22
star
74

chws_tool

Add OpenType chws/vchw features to fonts.
HTML
21
star
75

chinese

CSS
20
star
76

gf-glyphs-scripts

Scripts for Glyphs
Python
20
star
77

zen-antique

ZenFonts.jp Antique
Python
20
star
78

questrial

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

kosugi-maru

Kosugi Maru fonts, originally by Motoya
Python
19
star
80

staatliches

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

changa-vf

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

Roboto-Delta

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

picosvg-rs

A Rust version of picosvg.
Rust
15
star
84

silkscreen

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

gfregression

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

fez

Font Engineering made eaZy
Python
14
star
87

mavenproFont

Maven Pro family by Joe Prince
Makefile
14
star
88

BethEllen

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

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

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

ufomerge

ufomerge
Python
11
star
91

dynapuff

Fun blobby display font
Python
10
star
92

fontquant

Prove and quantify a font’s technical quality
Python
10
star
93

kosugi

Kosugi fonts, originally by Motoya
Python
10
star
94

flowify

Turn a font into a flow font
Python
10
star
95

namecheck

Python
9
star
96

zen-dots

Shell
9
star
97

ots-python

Python wheels for the OpenType Sanitizer
Python
9
star
98

variable-components-spec

8
star
99

mekorot

Hebrew Rashi Typeface
Python
8
star
100

Signika

Making a variable version of Signika, from Google Fonts
Python
8
star