fonttools-subset
generate optimized subsets of font files
TLDR
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
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
fonttools(1), woff2_compress(1)
