Skip to content

Instantly share code, notes, and snippets.

@justinpenner
Created February 28, 2022 19:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinpenner/f76a7cf056b487f5df0a96414e655b7f to your computer and use it in GitHub Desktop.
Save justinpenner/f76a7cf056b487f5df0a96414e655b7f to your computer and use it in GitHub Desktop.
Remove glyph outlines from a font while preserving everything else (advance widths, OT features)
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._g_l_y_f import Glyph
f = TTFont('Font.ttf')
assert 'glyf' in f and 'gvar' not in f, 'Must be a static font with a `glyf` table.'
for name in f['glyf'].keys():
if not f['glyf'][name].isComposite():
f['glyf'][name] = Glyph()
f.save('Font-Regular-Blank.ttf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment