Skip to content

Font subsetting for Rust (C++ present only for woff2 compression)

License

Notifications You must be signed in to change notification settings

bearcove/fontcull

Repository files navigation

fontcull

Crates.io Documentation License: MIT

Pure Rust font subsetting library powered by klippa.

Library usage

See the fontcull crate documentation for API details and examples.

CLI

The fontcull-cli crate provides a command-line tool that:

  1. Opens URLs in a headless browser (via chromiumoxide)
  2. Extracts all glyphs/characters used on the page (including ::before/::after pseudo-elements)
  3. Optionally spiders the site to find more pages
  4. Subsets font files to only include the characters actually used

Install

cargo install fontcull-cli

Requires Chrome/Chromium installed (uses your system browser, no specific version needed).

Usage

# Just get the unicode range of characters used
fontcull https://example.com

# Subset fonts based on page content
fontcull https://example.com --subset=fonts/*.ttf

# Spider multiple pages
fontcull https://example.com --spider-limit=10 --subset=fonts/*.ttf

# Filter by font family
fontcull https://example.com --subset=fonts/*.ttf --family="My Font"

# Add extra characters to always include
fontcull https://example.com --subset=fonts/*.ttf --whitelist="0123456789"

Sponsors

Thanks to all individual sponsors:

GitHub Sponsors Patreon

...along with corporate sponsors:

Zed Depot

...without whom this work could not exist.

About

Font subsetting for Rust (C++ present only for woff2 compression)

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 2

  •  
  •  

Languages