masters as separate vfb source files. EvB 08 """ from robofab.glifLib import GlyphSet from robofab.world import CurrentFont, CurrentGlyph, AllFonts from robofab.interface.all.dialogs import Message, GetFolder from robofab.tools.glyphNameSchemes import glyphNameToShortFileName import os f = CurrentFont() g = CurrentGlyph() f.save() todo = f.selection print "selection", todo if g is not None: todo.append(g.name) for f in AllFonts(): ufoPath = None print "f.path", f, f.path if f.path is None: # huh, in case there is a ghost font. print "skipping", f continue ufoPath = f.path.replace(".vfb", ".ufo") if not os.path.exists(ufoPath):
if not inShell: g.removeOverlap() g.correctDirection() g.unicode = int(uni, 16) g.update() f.update() if inShell: timeString = time.strftime("%Y-%m-%d_%H%M%S", time.localtime()) fileName = '%s_boxes.ufo' % timeString # fileName = 'boxes.ufo' f.lib['public.glyphOrder'] = generatedGlyphs outputPath = os.sep.join((os.path.curdir, fileName)) f.save(outputPath) print '\nFind your UFO file at %s' % os.path.abspath(outputPath) if inFL: fl.UpdateFont(fl.ifont) if inRF: # Modifying the glyph order, so it looks like the glyphs # have been appended at the end of the font. glyphOrder = f.lib['public.glyphOrder'] if not set(generatedGlyphs) <= set(glyphOrder): oldGlyphOrder = [g for g in glyphOrder if g not in generatedGlyphs] newGlyphOrder = oldGlyphOrder + generatedGlyphs f.glyphOrder = newGlyphOrder f.lib['public.glyphOrder'] = newGlyphOrder
exec(command) if not inShell: g.removeOverlap() g.correctDirection() g.unicode = int(uni, 16) g.update() f.update() if inShell: timeString = time.strftime("%Y-%m-%d_%H%M%S", time.localtime()) fileName = '%s_boxes.ufo' % timeString f.lib['public.glyphOrder'] = generatedGlyphs f.save(os.path.expanduser('~/Desktop/%s' % fileName)) if inFL: fl.UpdateFont(fl.ifont) if inRF: # Modifying the glyph order, so it looks like the glyphs have been appended at the end of the font. oldGlyphOrder = [ g for g in f.lib['public.glyphOrder'] if g not in generatedGlyphs ] newGlyphOrder = oldGlyphOrder + generatedGlyphs f.glyphOrder = newGlyphOrder f.lib['public.glyphOrder'] = newGlyphOrder if inGlyphs: f._object.font.enableUpdateInterface() print '\nDone.'