fontcull
A Rust port of the parts of glyphhanger I use regularly.
Why?
glyphhanger is amazing, but it's 5+ years old and requires a specific old version of Chrome/Puppeteer that's become painful to maintain. With the help of Claude, I ported the core functionality to Rust.
What it does
- Opens URLs in a headless browser (via chromiumoxide)
- Extracts all glyphs/characters used on the page (including
::before/::afterpseudo-elements) - Optionally spiders the site to find more pages
- Subsets font files to only include the characters actually used
Usage
# Just get the unicode range of characters used
# Subset fonts based on page content
# Spider multiple pages
# Filter by font family
# Add extra characters to always include
Subsetting backends
- klippa (default): Pure Rust subsetting via fontations, woff2 compression via vendored Google woff2
- pyftsubset (
--pyftsubset): Falls back to Python's fonttools (requirespip install fonttools brotli)
Install
Requires Chrome/Chromium installed (uses your system browser, no specific version needed).
Library usage
fontcull can also be used as a library for font subsetting:
use ;
use HashSet;
// Direct subsetting with known characters
let font_data = read.unwrap;
let chars: = "Hello World".chars.collect;
let woff2 = subset_font_to_woff2.unwrap;
// Or analyze HTML/CSS to find which characters are used (requires `static-analysis` feature)
let html = r#"<html><style>body { font-family: "MyFont"; }</style><body>Hello</body></html>"#;
let css = extract_css_from_html;
let analysis = analyze_fonts;
Features
klippa(default): Pure Rust font subsettingstatic-analysis: Static HTML/CSS parsing for font usage detectionbrowser(default): Browser-based glyph extraction for CLI
Sponsors
...without whom this work could not exist.