fonttools/Scripts/RoboFabIntro/demo_GlyphAppender.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

23 lines
590 B
Python

#FLM: Glyph Appender
"""Add a glyph to the current glyph"""
from robofab.world import CurrentFont, CurrentGlyph
from robofab.interface.all.dialogs import SelectGlyph
glyph = CurrentGlyph()
font = CurrentFont()
# select a glyph to add
selected = SelectGlyph(font)
# make sure that we are not trying add the current glyph to itself
if selected.name != glyph.name:
# preserve the current state
fl.SetUndo()
# add the selected glyph to the current glyph
glyph.appendGlyph(selected)
# always update the glyph!
glyph.update()
# and, just to be safe, update the font...
font.update()