Skip to content

Instantly share code, notes, and snippets.

@jdbdnz
Last active November 3, 2020 10:24
Show Gist options
  • Save jdbdnz/77b2d0c969bfd3e9321a66275ecc59d0 to your computer and use it in GitHub Desktop.
Save jdbdnz/77b2d0c969bfd3e9321a66275ecc59d0 to your computer and use it in GitHub Desktop.
Limit FontAwesome to just those Glyphs I want to use
# Open font in [fontforge](https://fontforge.github.io/en-US/) (FontAwesome's [fa-solid-900.woff](https://github.com/FortAwesome/Font-Awesome/blob/master/webfonts/fa-solid-900.woff) in my case)
# So you can see what you're doing: Menu > Encoding > Compact
# ctrl+a to select all glyphs
# ctrl+. should open Execute Script
# Ensure desiredGlyphNames includes all glyphs used in app
desiredGlyphNames = ["caret-down", "caret-up", "chart-bar", "check", "chevron-down", "clipboard-list", "comments", "expand", "filter", "flask", "images", "info-circle", "layer-group", "redo", "ruler", "ruler-horizontal", "ruler-vertical", "sort-amount-down", "star", "table", "tag", "users", "video"]
font = fontforge.activeFont()
for glyph in list(font.selection.byGlyphs):
glyphNotUsed = glyph.glyphname not in desiredGlyphNames
if glyphNotUsed:
glyph.clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment