Skip to main content

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-range splitting 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=400 pins, wght=400:700 limits, wght=300:400:700 limits and moves the default, opsz=drop pins 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.

Axis pins and ranges outside the font's advertised bounds are rejected. Coverage reports include the full missing count; missing-text examples show at most 500 characters. Duplicate upload names get numbered output names in ZIPs and CSS.

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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for localtools-font-subsetter 1.0.2
File Size Uploaded Provenance Actions
localtools_font_subsetter-1.0.2.tar.gz 82.3 kB Without provenance Details for localtools_font_subsetter-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for localtools-font-subsetter 1.0.2
File Interpreter ABI Platform Actions
localtools_font_subsetter-1.0.2-py3-none-any.whl Python 3 none any Details for localtools_font_subsetter-1.0.2-py3-none-any.whl

Total release size: 167.4 kB

Release files / localtools_font_subsetter-1.0.2.tar.gz

Download URL localtools_font_subsetter-1.0.2.tar.gz
Size 82.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eec405286ea8b0a80d9157ffdf13008781cb47a21606d8d99947f8e04e3ca85c
BLAKE2b-256 checksum
How to use checksums
c080f6bf31fe8e2d567aa6420341885be71128d22746ea76f2db83e26e94c55c
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.2-py3-none-any.whl

Download URL localtools_font_subsetter-1.0.2-py3-none-any.whl
Size 85.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9076377349d8b569a05ba20e23bdcc34337847f64a2d1aeb8210a8562e5cf4f
BLAKE2b-256 checksum
How to use checksums
969d559110be19ba16345585062d461394b015a5babdc13ba858e5e34faa8556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for localtools-font-subsetter 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page