fonttools/Scripts/RoboFabIntro/demo_UFORemoveOverlap.py
Erik van Blokland 617945dcf1 The scripts folder for FontLab as they shipped with Fab 1.1.1.
git-svn-id: http://svn.robofab.com/trunk@22 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-16 08:14:00 +00:00

32 lines
808 B
Python

#FLM: UFO Remove Overlap
"""
Remove overlap on all glyphs in a .ufo font.
This script sis more than a little silly, but it
demonstrates how objectsRF and objectsFL can
work hand in hand.
"""
from robofab.objects.objectsRF import OpenFont
from robofab.objects.objectsFL import NewFont
from robofab.interface.all.dialogs import ProgressBar
ufoFont = OpenFont(note="Select a .ufo")
if ufoFont:
bar = ProgressBar('Removing Overlap...', len(ufoFont))
flFont = NewFont()
flGlyph = flFont.newGlyph('OverlapRemover')
for ufoGlyph in ufoFont:
flPen = flGlyph.getPointPen()
ufoGlyph.drawPoints(flPen)
flGlyph.removeOverlap()
ufoPen = ufoGlyph.getPointPen()
ufoGlyph.clear()
flGlyph.drawPoints(ufoPen)
flGlyph.clear()
bar.tick()
flFont.close(save=0)
bar.close()
ufoFont.save(doProgress=True)