LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

fonttools-subset

generate optimized subsets of font files

TLDR

Subset a font to Basic Latin code points
$ fonttools subset [path/to/font.ttf] --unicodes=U+0000-007F
copy
Write the subset with an explicit output path
$ fonttools subset [path/to/font.ttf] --unicodes=U+0000-007F --output-file=[path/to/subset.ttf]
copy
Emit WOFF2 instead of TTF
$ fonttools subset [path/to/font.ttf] --unicodes=U+0000-007F --flavor=woff2
copy
Keep only selected OpenType layout features
$ fonttools subset [path/to/font.ttf] --unicodes=U+0000-007F --layout-features=onum,kern
copy

SYNOPSIS

fonttools subset [options] font-file

DESCRIPTION

fonttools subset generates optimized subsets of font files by including only specified glyphs, Unicode ranges, or OpenType features. This is essential for web font optimization, reducing file sizes significantly by removing unused characters.The tool supports TrueType (.ttf), OpenType (.otf), WOFF, and WOFF2 formats. It can convert between formats during subsetting using the --flavor option.Common use cases include creating language-specific subsets, web-optimized fonts with only Latin characters, or icon fonts with specific glyphs.

PARAMETERS

--unicodes=RANGE

Unicode code points to include (e.g., U+0000-007F for Basic Latin)
--flavor=FORMAT
Output format: woff, woff2, or omit for original format
--layout-features=LIST
Comma-separated OpenType features to keep (e.g., kern,liga,onum)
--output-file=PATH
Specify output filename; defaults to input with .subset suffix
--text=STRING
Include only glyphs needed for the given text
--text-file=FILE
Include glyphs needed for text in the specified file
--no-hinting
Remove hinting instructions to reduce file size
--desubroutinize
Remove subroutines from CFF fonts

INSTALL

sudo dnf install fonttools
copy
sudo apk add py3-fonttools
copy
brew install fonttools
copy

CAVEATS

WOFF2 output requires the brotli Python package. Some complex OpenType features may not subset correctly if dependent glyphs are excluded. Always test subsetted fonts thoroughly.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid