Skip to content

Your web font utility belt. It can subset web fonts. It can find unicode-ranges for you automatically. It makes julienne fries.

License

Notifications You must be signed in to change notification settings

ronyeh/glyphhanger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glyphhanger

Your web font utility belt. It can subset web fonts. It can show you what unicode-ranges are used on a web site (optionally per font-family). It can also subset web fonts automatically using the unicode-ranges it found. It makes julienne fries.

Installation

Available on npm.

npm install -g glyphhanger

Prerequisite: pyftsubset

See https://github.com/fonttools/fonttools.

pip install fonttools
# Additional installation for --flavor=woff2
git clone https://github.com/google/brotli
cd brotli
python setup.py install

# Additional installation for --flavor=woff --with-zopfli
git clone https://github.com/anthrotype/py-zopfli
cd py-zopfli
git submodule update --init --recursive
python setup.py install

If you want to read an in-depth tutorial on the installation steps above, please read How I set up Glyphhanger on macOS for optimizing and converting font files for the Web by Sara Soueidan.

Usage

Related: operate on existing unicode-range values with Unicode Range Interchange (read the blog post).

Find the glyphs in a local file or url

# local file
glyphhanger ./test.html
glyphhanger ./test.txt

# output characters instead of Unicode code points
glyphhanger ./test.html --string

# remote URL
glyphhanger https://example.com

# multiple URLs, optionally using HTTPS
glyphhanger https://google.com https://www.zachleat.com

# show results for each font-family on the page
glyphhanger ./test.html --json

# show results only for one or more font-family names
glyphhanger ./test.html --family='Open Sans, Roboto'

# Show version
glyphhanger --version

# See more usage
glyphhanger --help

Debug Mode

Replaces --verbose in v3.0.0.

> DEBUG=glyphhanger* glyphhanger https://example.com

Subset font files automatically

Use --subset=*.ttf to select some font files for subsetting. Note that you can also subset yourself manually with pyftsubset (but glyphhanger is easier).

Note that the DEBUG output documented above will log the specif