Skip to content

Instantly share code, notes, and snippets.

@iSWORD
Created February 15, 2017 11:00
Show Gist options
  • Save iSWORD/a849b7c7ec6a57d4789f87c3c34d262f to your computer and use it in GitHub Desktop.
Save iSWORD/a849b7c7ec6a57d4789f87c3c34d262f to your computer and use it in GitHub Desktop.
#!/usr/bin/python2
import sys, fontforge, string
allowed_chars = string.printable # ascii (32 -> 126)
if len(sys.argv) == 3:
font = fontforge.open(sys.argv[1])
for char in allowed_chars.decode("UTF-8"):
font.selection[ord(char)] = True
font.selection.invert()
for glyph in font.selection.byGlyphs:
font.removeGlyph(glyph)
font.generate(sys.argv[2])
else:
print "Usage: {} [input.ttf] [output.ttf]".format(sys.argv[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment