Skip to content

Instantly share code, notes, and snippets.

@franjohn21
Last active December 18, 2020 13:31
Show Gist options
  • Save franjohn21/f9aea7961275a093b93f19e1ea82fc72 to your computer and use it in GitHub Desktop.
Save franjohn21/f9aea7961275a093b93f19e1ea82fc72 to your computer and use it in GitHub Desktop.
Most performance font subsetting options via `pyftsubset`
// For definition of each option: https://github.com/fonttools/fonttools/blob/master/Lib/fontTools/subset/__init__.py#L39
pyftsubset path/to/existing/font.otf \
--unicodes-file=path/to/unicode/file.txt \
--flavor=woff2 \
--layout-features='' \
--no-hinting \
--desubroutinize \
--name-IDs='' \
--drop-tables+=GSUB \
--with-zopfli
@RoelN
Copy link

RoelN commented Sep 25, 2017

You probably have realised this, but take heed that these settings severely cripple the font. All OpenType layout features are dropped, including kerning (!), and hinting will be completely stripped. Also the name table is removed, which is probably against even open font licenses, and at the very least bad form. (It's like stripping the author name from open source JavaScript libraries)

It's a fun exercise in trying to get a small font file, but the sacrifice in legibility makes this very unsuitable for production, especially since you'll be talking about just a few kilobytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment