Skip to content

Instantly share code, notes, and snippets.

@frankrolf
Last active January 30, 2017 18:18
Show Gist options
  • Save frankrolf/ac4d43f489ac82530b1519845800e70e to your computer and use it in GitHub Desktop.
Save frankrolf/ac4d43f489ac82530b1519845800e70e to your computer and use it in GitHub Desktop.
# 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