Last active
January 30, 2017 18:18
-
-
Save frankrolf/ac4d43f489ac82530b1519845800e70e to your computer and use it in GitHub Desktop.
This file contains 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
# Robofont script to remove broken image paths, keeping good ones intact. | |
import os | |
f = CurrentFont() | |
layerOrder = ['foreground'] | |
layerOrder.extend(f.layerOrder) | |
for g in f: | |
for layerName in layerOrder: | |
layeredGlyph = g.getLayer(layerName) | |
if layeredGlyph.lib.get('com.typemytype.robofont.image', None): | |
if not os.path.exists(layeredGlyph.lib['com.typemytype.robofont.image']['path']): | |
print 'Removing orphan image from {} ({})'.format(layeredGlyph.name, layerName) | |
del(layeredGlyph.lib['com.typemytype.robofont.image']) | |
print 'done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment