Erik van Blokland 3646055ea2 initial import
git-svn-id: http://svn.robofab.com/trunk@1 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-07 17:40:34 +00:00

22 lines
594 B
Python

# robofab manual
# Glyph object
# method examples
# In FontLab the baseglyph of a component can't be changed easily.
# This assumes that there will only be
# one component that needs to be remapped.
def remapComponent(glyph, oldBaseGlyph, newBaseGlyph):
foundComponent = None
for component in glyph.components:
if component.baseGlyph = oldBaseGlyph:
foundComponent = component
break
if foundComponent is None:
return
offset = foundComponent.offset
scale = foundComponent.scale
glyph.removeComponent(component)
glyph.appendComponent(newBaseGlyph, offset=offset, scale=scale)