localtools-font-subsetter
Make web fonts small, on your machine: subset TTF/OTF/WOFF/WOFF2 fonts to the characters you actually use (Unicode
presets, your own text, or Unicode ranges), keep or drop OpenType features, drop hinting, pin or limit variable-font axes
(e.g. wght 400 to 700), and write WOFF2, WOFF or TTF/OTF. Each result shows before/after size and glyph count, a coverage
report (which requested characters the font does not have), font metadata (family, style, axes, license, fsType embedding
bits, with a warning when they forbid embedding or subsetting), a live preview rendered with the subset font, and a
ready-to-paste @font-face rule with the exact unicode-range. Nothing leaves your computer.
Install
| OS | command |
|---|---|
| Windows (PowerShell) | irm https://raw.githubusercontent.com/chayprabs/localtools/main/font-subsetter/install.ps1 | iex |
| macOS / Linux | curl -fsSL https://raw.githubusercontent.com/chayprabs/localtools/main/font-subsetter/install.sh | bash |
| PyPI (Python 3.10+) | pipx install localtools-font-subsetter |
The installer unpacks a portable build with its own Python 3.13 (17 MB zip on Windows, 24 to 39 MB on macOS/Linux).
Use
UI: run localtools-font-subsetter (or the Start menu / Applications launcher). It opens http://127.0.0.1:47129.
Drop one or more fonts, tick presets (Latin, Latin Ext, Cyrillic, Cyrillic Ext, Greek, Greek Ext, Vietnamese, or Keep all)
and/or type sample text, optionally Unicode ranges, layout features and axes, pick a format, press Subset. The preview line
is editable. Copy CSS and Download sit on each result.
- Presets use the same ranges Google Fonts serves, so
unicode-rangesplitting works the way the web expects. - Layout features:
default(fontTools' set: kern, liga, calt, mark, mkmk, locl, ...),all,none, an exact list (kern,liga) or edits to the default (+ss01,+tnum,-liga). - Axes use fontTools instancer syntax:
wght=400pins,wght=400:700limits,wght=300:400:700limits and moves the default,opsz=droppins to the default. Pin every axis to get a static font. - Hinting is dropped by default (smaller files; browsers on modern systems barely use it). Tick Keep hinting to keep it.
CLI:
localtools-font-subsetter subset Inter.ttf --preset latin --text "Ωμέγα" --format woff2 -o out/
localtools-font-subsetter subset RobotoFlex.ttf --preset latin,latin-ext --axes "wght=400:700 opsz=drop" -o out/ --css > fonts.css
localtools-font-subsetter subset *.otf --text-file page.html --features +tnum --format woff -o out/ --json
Output files are <name>-subset.<ext>. Missing characters and license warnings go to stderr; --css prints the
@font-face rules, --json the full report.
API: POST /api/subset, multipart: file (repeat for several fonts), preset (comma list), text, unicodes,
features, hinting (1), axes, format (woff2 woff ttf otf). One font returns the font file, several return a zip
with fonts.css. POST /api/report takes the same fields and returns JSON (sizes, glyphs, axes, metadata, coverage,
warnings, CSS, base64 font). Errors: 400 {"error": "..."}.
curl -F file=@Inter.ttf -F preset=latin -F text=Hello -F format=woff2 -o Inter-subset.woff2 http://127.0.0.1:47129/api/subset
Engine
fontTools (MIT): fontTools.subset is pyftsubset, and fontTools.varLib.instancer
is the reference variable-font instancer; Google Fonts and most font foundries build with them. WOFF2 uses Google's
brotli (MIT). The font is subset first and instanced second: that is faster, and it
avoids a fontTools failure when subsetting an already partially-instanced font in memory. The full name table (copyright,
license, instance names) is kept.
Not included
- Font collections (
.ttc/.otc): refused with a clear error; extract a single font first. - EOT and SVG fonts: obsolete web formats.
- Instancing large variable fonts is slow (a 2 MB, 4,500-glyph font takes about 20 s). Subsetting first helps a lot.
Update / uninstall
localtools-font-subsetter update / localtools-font-subsetter uninstall (installer builds). For PyPI installs:
pipx upgrade localtools-font-subsetter / pipx uninstall localtools-font-subsetter.
License
MIT. Test fonts in samples/ are subsets of Inter, Roboto Flex and Noto Sans (SIL OFL 1.1, see samples/licenses/).
Metadata
Release files for localtools-font-subsetter 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| localtools_font_subsetter-1.0.1.tar.gz | 81.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| localtools_font_subsetter-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 165.7 kB
Release files / localtools_font_subsetter-1.0.1.tar.gz
| Download URL | localtools_font_subsetter-1.0.1.tar.gz |
|---|---|
| Size | 81.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bddabaf8f223fb66cc101abd2d531af62e562f2c176b35fb7ad1072200c4b2e
|
|
BLAKE2b-256 checksum How to use checksums |
c6cb3ffddb8a9951a223def8b10fe7e2cdfdad46032dcc2c1b5be93a444831e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Release files / localtools_font_subsetter-1.0.1-py3-none-any.whl
| Download URL | localtools_font_subsetter-1.0.1-py3-none-any.whl |
|---|---|
| Size | 84.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cfbf3c2278c29e8c68e80e30797d521ba2a138b6e5aec8837e11d04f1de0062
|
|
BLAKE2b-256 checksum How to use checksums |
dd7beb2328a5e4e0894dd6713491930a889325a47497c5bc3c3dc315bd6a94d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|