Updated for UFO2 """ from robofab.glifLib import GlyphSet from robofab.world import CurrentFont, CurrentGlyph from robofab.interface.all.dialogs import Message import os f = CurrentFont() g = CurrentGlyph() ufoPath = f.path.replace(".vfb", ".ufo") if not os.path.exists(ufoPath): Message("No UFO found for this font. I'm looking for \"%s\"."%(os.path.basename(ufoPath) )) if g is not None: todo = [g.name] else: todo = f.selection if todo: Message("Exporting %s to \"%s\"."%(", ".join(todo), os.path.basename(ufoPath) )) f.writeUFO(doHints=False, doInfo=False, doKerning=False, doGroups=False, doLib=False, doFeatures=False, glyphs=todo) else: Message("No glyphs selected for export.") print 'done'
import os f = CurrentFont() g = CurrentGlyph() todo = None ufoPath = f.path.replace(".vfb", ".ufo") if not os.path.exists(ufoPath): Message("No UFO found for this font. I'm looking for \"%s\"." % (os.path.basename(ufoPath))) if g is not None: todo = [g.name] else: todo = f.selection if todo: Message("Exporting %s to \"%s\"." % (", ".join(todo), os.path.basename(ufoPath))) f.writeUFO(doHints=False, doInfo=False, doKerning=False, doGroups=False, doLib=False, doFeatures=False, glyphs=todo) else: Message("No glyphs selected for export.") print 'done'
#FLM: Export Current Font to UFO Format """ Export the current font to UFO format. """ from robofab.world import CurrentFont f = CurrentFont() if f.path is None: from robofab.interface.all.dialogs import PutFile path = PutFile("Please choose a name for the .ufo") if path is None: path = -1 # signal the code below the user has cancelled else: # writeUFO() will firgure out the destination .ufo path path = None if path != -1: f.writeUFO(path, doProgress=True) print 'DONE!'