Created
February 28, 2022 19:21
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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