def generateGlyphsToFont(self, exportFont=None, layerName=None): font = RFont(showUI=False) if exportFont is None else exportFont currentFont = self.currentFont filterName = self.currentFilterName currentFilter = self.filters[filterName] if currentFont is not None and len(currentFont.selection): glyphs = [currentFont[glyphName] for glyphName in currentFont.selection if glyphName in currentFont] for glyph in glyphs: if len(glyph.components) > 0: for comp in glyph.components: baseGlyphName = comp.baseGlyph baseGlyph = currentFont[baseGlyphName] baseFilteredGlyph = currentFilter(baseGlyph) newFont.insertGlyph(baseFilteredGlyph, baseGlyphName) newFont[baseGlyphName].unicode = baseFilteredGlyph.unicode filteredGlyph = currentFilter(glyph) if filteredGlyph is not None: if exportFont is None: font.insertGlyph(filteredGlyph, glyph.name) else: glyph = font[glyph.name] if layerName is None else font[glyph.name].getLayer(layerName) glyph.clearContours() glyph.clearComponents() glyph.appendGlyph(filteredGlyph) font.showUI() else: message(u'PenBallWizard', 'No selected glyphs to generate')
def resetRepresentations(self): font = self.currentFont self.cachedFont = RFont(showUI=False) if font is not None: for glyphName in self.glyphNames: if glyphName in font: font[glyphName].naked().destroyAllRepresentations()
def initCachedFont(self): currentFont = self.currentFont self.cachedFont = RFont(showUI=False) if currentFont is not None: for metric in ['ascender', 'descender', 'unitsPerEm']: setattr(self.cachedFont.info, metric, getattr(currentFont.info, metric))
def fontChanged(self, notification): if 'font' in notification: self.releaseObservedGlyphs() self.stringInput(self.w.textInput) self.currentFont = notification['font'] self.cachedFont = RFont(showUI=False) self.updatePreview()
def showWindow(self, font): try: a = [] for idx in range(len(font.masters)): a.append(RFont(font, idx)) FlexibleWindow(a) except: import traceback print(traceback.format_exc()) return (True, None)
def generateGlyphsToFont(self, exportFont=None, layerName=None): font = RFont(showUI=False) if exportFont is None else exportFont currentFont = self.currentFont filterName = self.currentFilterName currentFilter = self.filters[filterName] if currentFont is not None and len(currentFont.selection): glyphs = [ currentFont[glyphName] for glyphName in currentFont.selection if glyphName in currentFont ] for glyph in glyphs: if len(glyph.components) > 0: for comp in glyph.components: baseGlyphName = comp.baseGlyph baseGlyph = currentFont[baseGlyphName] baseFilteredGlyph = currentFilter(baseGlyph) newFont.insertGlyph(baseFilteredGlyph, baseGlyphName) newFont[ baseGlyphName].unicode = baseFilteredGlyph.unicode filteredGlyph = currentFilter(glyph) if filteredGlyph is not None: if exportFont is None: font.insertGlyph(filteredGlyph, glyph.name) else: glyph = font[ glyph.name] if layerName is None else font[ glyph.name].getLayer(layerName) glyph.clearContours() glyph.clearComponents() glyph.appendGlyph(filteredGlyph) font.showUI() else: message(u'PenBallWizard', 'No selected glyphs to generate')
def __init__(self): self.filters = PenBallFiltersManager() self.filters.loadFiltersFromJSON('/'.join([LOCALPATH, JSONFILE])) self.glyphNames = [] self.observedGlyphs = [] self.cachedFont = RFont(showUI=False) self.currentFont = CurrentFont() filtersList = self.filters.keys() if len(filtersList) > 0: self.currentFilterName = filtersList[0] else: self.currentFilterName = None self.fill = True self.observers = [ ('fontChanged', 'fontBecameCurrent'), ('fontChanged', 'fontDidOpen'), ('fontChanged', 'fontDidClose'), ] self.w = Window((100, 100, 800, 500), 'PenBall Wizard v{0}'.format(__version__), minSize=(500, 400)) self.w.filtersPanel = Group((0, 0, 300, -0)) self.w.filtersPanel.filtersList = List((0, 0, -0, -40), filtersList, selectionCallback=self.filterSelectionChanged, doubleClickCallback=self.filterEdit, allowsMultipleSelection=False, allowsEmptySelection=False, rowHeight=22) self.w.filtersPanel.controls = Group((0, -40, -0, 0)) self.w.filtersPanel.addFilter = SquareButton((0, -40, 100, 40), 'Add filter', sizeStyle='small', callback=self.addFilter) self.w.filtersPanel.addFilterChain = SquareButton((100, -40, 100, 40), 'Add operations', sizeStyle='small', callback=self.addFilterChain) self.w.filtersPanel.removeFilter = SquareButton((-100, -40, 100, 40), 'Remove filter', sizeStyle='small', callback=self.removeFilter) self.w.textInput = EditText((300, 0, -90, 22), '', callback=self.stringInput) self.w.generate = SquareButton((-90, 0, 90, 22), 'Generate', callback=self.generateGlyphsToFont, sizeStyle='small') self.w.preview = MultiLineView((300, 22, -0, -0)) self.w.switchFillStroke = SquareButton((-75, -40, 60, 25), 'Stroke', callback=self.switchFillStroke, sizeStyle='small') displayStates = self.w.preview.getDisplayStates() for key in ['Show Metrics','Upside Down','Stroke','Beam','Inverse','Water Fall','Multi Line']: displayStates[key] = False for key in ['Fill','Single Line']: displayStates[key] = True self.w.preview.setDisplayStates(displayStates) for callback, event in self.observers: addObserver(self, callback, event) self.updateControls() self.w.bind('close', self.end) self.launchWindow() self.w.open()
def SelectFont(message="Select a font:", title='RoboFab'): """ Returns font instance if there is one, otherwise it returns None. Availability: FontLab """ from robofab.world import RFont if inFontLab: list = [] for i in range(fl.count): list.append(fl[i].full_name) name = OneList(list, message, title) if name is None: return None else: return RFont(fl[list.index(name)]) else: _raisePlatformError('SelectFont')
def generateGlyphsToFont(self, sender): newFont = RFont(showUI=False) font = self.currentFont filterName = self.currentFilterName currentFilter = self.filters[filterName] if font is not None: glyphs = [font[glyphName] for glyphName in font.selection if glyphName in font] for glyph in glyphs: if len(glyph.components) > 0: for comp in glyph.components: baseGlyphName = comp.baseGlyph baseGlyph = font[baseGlyphName] baseFilteredGlyph = currentFilter(baseGlyph) newFont.insertGlyph(baseFilteredGlyph, baseGlyphName) newFont[baseGlyphName].unicode = baseFilteredGlyph.unicode filteredGlyph = currentFilter(glyph) if filteredGlyph is not None: newFont.insertGlyph(filteredGlyph, glyph.name) newFont.showUI()
#!/usr/bin/env python # Script to generate the germandbls, by Jennifer Mantas from robofab.world import RFont font = RFont('Morphologic.ufo') try: glyph = font['germandbls'] except KeyError: glyph = font.newGlyph('germandbls') pen = glyph.getPen() # ! Drawing instructions here ! # ! Otherwise nothing happens ! font.save()
#coding=utf-8 from mutatorScale.objects.scaler import MutatorScaleEngine from mutatorScale.utilities.fontUtils import intersect from robofab.world import RFont paths = [ 'testFonts/two-axes/regular-low-contrast.ufo', 'testFonts/two-axes/bold-low-contrast.ufo' ] outputPath = 'testFonts/two-axes/scaled-low-contrast.ufo' fonts = [] for p in paths: fonts.append(RFont(p)) scaler = MutatorScaleEngine(fonts) scaler.set({'scale': (0.85, 0.8)}) outputFont = RFont() for glyphName in 'AHIO': glyph = scaler.getScaledGlyph(glyphName, (95, 75)) outputFont.insertGlyph(glyph, glyphName) outputFont.save(outputPath)
# robothon06 # demo of executing python in FontLab, MacOS only # this script runs in the Python IDE # it will send some python code to FontLab # FontLab will execute the python code: # it will find the current glyph and send it to our other script. from robofab.tools.remote import runFontLabRemote, receiveGlyph from robofab.world import RFont # this is what we want FontLab to do: pythonCode = """ from robofab.world import CurrentGlyph from robofab.tools.remote import transmitGlyph g = CurrentGlyph() transmitGlyph(g) """ # this the font where we'll store the glyph from FontLab destFont = RFont() result = runFontLabRemote(pythonCode) receiveGlyph(result, destFont) print destFont.keys()
def generate_base_fonts(data, italic): """Generate a list of RFonts with metadata loaded from .glyphs data.""" date_created = to_rf_time(data.pop('date')) family_name = data.pop('familyName') units_per_em = data.pop('unitsPerEm') version_major = data.pop('versionMajor') version_minor = data.pop('versionMinor') user_data = data.pop('userData', {}) copyright = data.pop('copyright', None) designer = data.pop('designer', None) designer_url = data.pop('designerURL', None) manufacturer = data.pop('manufacturer', None) manufacturer_url = data.pop('manufacturerURL', None) misc = ['DisplayStrings', 'disablesAutomaticAlignment', 'disablesNiceNames'] custom_params = parse_custom_params(data, misc) rfonts = {} master_id_order = [] for master in data['fontMaster']: rfont = RFont() rfont.info.familyName = build_family_name(family_name, master, 'width') rfont.info.styleName = build_style_name(master, 'weight', italic) rfont.info.openTypeHeadCreated = date_created rfont.info.unitsPerEm = units_per_em rfont.info.versionMajor = version_major rfont.info.versionMinor = version_minor if copyright: rfont.info.copyright = copyright if designer: rfont.info.openTypeNameDesigner = designer if designer_url: rfont.info.openTypeNameDesignerURL = designer_url if manufacturer: rfont.info.openTypeNameManufacturer = manufacturer if manufacturer_url: rfont.info.openTypeNameManufacturerURL = manufacturer_url rfont.info.ascender = master.pop('ascender') rfont.info.capHeight = master.pop('capHeight') rfont.info.descender = master.pop('descender') rfont.info.xHeight = master.pop('xHeight') horizontal_stems = master.pop('horizontalStems', None) vertical_stems = master.pop('verticalStems', None) if horizontal_stems: rfont.info.postscriptStemSnapH = horizontal_stems if vertical_stems: rfont.info.postscriptStemSnapV = vertical_stems set_redundant_data(rfont) set_blue_values(rfont, master.pop('alignmentZones', [])) set_family_user_data(rfont, user_data) set_master_user_data(rfont, master.pop('userData', {})) set_robofont_guidelines(rfont, master, is_global=True) # handle random optional stuff misc = ['weightValue', 'widthValue'] for name, value in custom_params + parse_custom_params(master, misc): # deal with any Glyphs naming quirks here if name == 'disablesNiceNames': name = 'useNiceNames' value = int(not value) opentype_attr_prefix_pairs = ( ('hhea', 'Hhea'), ('description', 'NameDescription'), ('typo', 'OS2Typo'), ('win', 'OS2Win'), ('vendorID', 'OS2VendorID'), ('fsType', 'OS2Type')) for glyphs_prefix, ufo_prefix in opentype_attr_prefix_pairs: name = re.sub( '^' + glyphs_prefix, 'openType' + ufo_prefix, name) postscript_attrs = ('underlinePosition', 'underlineThickness') if name in postscript_attrs: name = 'postscript' + name[0].upper() + name[1:] # enforce that winAscent/Descent are positive, according to UFO spec if name.startswith('openTypeOS2Win') and value < 0: value = -value # most OpenType table entries go in the info object # the misc attributes double as deprecated info attributes! # they are Glyphs-related, not OpenType-related, and don't go here if hasattr(rfont.info, name) and name not in misc: setattr(rfont.info, name, value) # everything else gets dumped in the lib else: rfont.lib[GLYPHS_PREFIX + name] = value master_id = master.pop('id') rfont.lib[GLYPHS_PREFIX + 'fontMasterID'] = master_id master_id_order.append(master_id) rfonts[master_id] = rfont return rfonts, master_id_order
#FLM: RoboFab Intro, Interpolating two fonts # Basic interpolation of two fonts. This is clean # non-FontLab specific implementation of # interpolating. This interpolation is strict: it # adds no points to contours, it does not alter # the outlines of the extremes in any possible # way. Note that this works in FontLab as well as # NoneLab. # # In fontlab: select two .vfb files, the result will be a new .vfb # In NoneLab: select two .ufo files, the result will be a new .ufo from robofab.world import OpenFont, RFont, RGlyph from robofab.pens.pointPen import AbstractPointPen from robofab.interface.all.dialogs import GetFolder f = OpenFont(None, "First master") g = OpenFont(None, "Second master") factor = .5 d = RFont() d.interpolate(factor, f, g) path = GetFolder("Select a place to save this UFO") if path: d.save(path) print 'done'
#!/usr/bin/env python # Script to generate the ampersand, by Tamara Hell from robofab.world import RFont font = RFont('Morphologic.ufo') glyph = font.newGlyph('ampersand') pen = glyph.getPen() pen.moveTo((225,0)) pen.lineTo((175,50)) pen.lineTo((125,150)) pen.lineTo((225,300)) pen.lineTo((175,400)) pen.lineTo((275,550)) pen.lineTo((425,525)) pen.lineTo((475,375)) pen.lineTo((350,225)) pen.lineTo((425,150)) pen.lineTo((525,225)) pen.lineTo((500,250)) pen.lineTo((500,275)) pen.lineTo((625,275)) pen.lineTo((625,250)) pen.lineTo((550,200)) pen.lineTo((525,175)) pen.lineTo((425,100)) pen.lineTo((475,50)) pen.lineTo((550,25)) pen.lineTo((550,0))
#coding=utf-8 from mutatorScale.objects.scaler import MutatorScaleEngine from mutatorScale.utilities.fontUtils import intersect from robofab.world import RFont paths = [ 'testFonts/two-axes/regular-low-contrast.ufo', 'testFonts/two-axes/bold-low-contrast.ufo' ] outputPath = 'testFonts/two-axes/scaled-low-contrast.ufo' fonts = [] for p in paths: fonts.append(RFont(p)) scaler = MutatorScaleEngine(fonts) scaler.set({ 'scale' : (0.85, 0.8) }) outputFont = RFont() for glyphName in 'AHIO': glyph = scaler.getScaledGlyph(glyphName, (95, 75)) outputFont.insertGlyph(glyph, glyphName) outputFont.save(outputPath)
not_supported_langs[lang] = missing_glyphs not_supported_ordered = not_supported_langs.keys() # print info print 'fully supported languages:' print '-' * n print '%s\n' % ' '.join(sorted(supported_langs)) print 'not fully supported:' print '-' * n print '%s\n' % ' '.join(sorted(not_supported_langs.keys())) print 'missing glyphs for each language:' print '-' * n for lang in sorted(not_supported_langs.keys()): print '%s (%s):' % (lang, len(not_supported_langs[lang])) print '%s\n' % ' '.join(not_supported_langs[lang]) # constants diacritics_glyphnames = convert_chars_to_glyphnames(diacritics_chars) # test if __name__ == '__main__': from robofab.world import RFont f1 = u"/_fonts/_Calligraphica/_ufos/Calligraphica_08.ufo" f2 = u"/_fonts/_Gothica/_ufos/Gothica_Sans-15-2.ufo" f3 = u"/_fonts/_Imperial/_ufos/Imperial_Sans-18-2-3.ufo" font = RFont(f3) # check_language_coverage('portuguese', font.keys()) check_languages_coverage(font.keys())
if not callable(test): raise except: raise AttributeError( '''\ Please update your objectsGS.py file. Download the latest verion at: https://github.com/schriftgestalt/Glyphs-Scripts''') # Check if a font is open -- if not, create a new one. f = CurrentFont() if f is None: f = RFont() if f is not None and inGlyphs: f._object.font.disableUpdateInterface() names = { # List of glyphs and their drawing recipes. # Lines: ('lighthorzbxd', '2500'): ['horBar()'], ('heavyhorzbxd', '2501'): ['horBar(FAT)'],
#!/usr/bin/env python # Script to generate the w, by Peer Viktor Guba from robofab.world import RFont font = RFont('Morphologic.ufo') glyph = font.newGlyph('w') pen = glyph.getPen() # ! Drawing instructions here ! # ! Otherwise nothing happens ! pen.moveTo((175,400)) pen.lineTo((250,0)) pen.lineTo((350,530)) pen.lineTo((475,-150)) pen.lineTo((630,750)) pen.lineTo((590,750)) pen.lineTo((475,-100)) pen.lineTo((350,582)) pen.lineTo((250,55)) pen.lineTo((210,400)) pen.closePath() font.save()
#!/usr/bin/env python from robofab.world import RFont font = RFont() font.info.familyName = "Morphologic" font.info.styleName = "Regular" font.info.postscriptFullName = font.info.familyName + ' ' + font.info.styleName font.info.postscriptFontName = font.info.familyName + '-' + font.info.styleName font.info.ascender = 750 font.info.descender = -250 font.info.xHeight = 500 font.info.capHeight = 750 font.info.unitsPerEm = 1000 font.save('Morphologic.ufo')
exceptions = consolidateExceptions(flatExceptions, organizedSourceGroups) print 'building new kerning object ...' newKerning = {} newKerning.update(best_value_pairs) # print len(best_value_pairs) newKerning.update(exceptions) return newKerning ufoLib.UFOWriter = CustomWriter # subclassing UFO writer to use the writer contained in this script. f_source = Font(sys.argv[-2]) f_target = Font(sys.argv[-1]) # if f_target.lib['org.unifiedfontobject.normalizer.modTimes']: # del(f_target.lib['org.unifiedfontobject.normalizer.modTimes']) inputDirName, inputFileName = os.path.split(f_target.path.rstrip(os.sep)) outputFileName = inputFileName.replace('.ufo', '_mod.ufo') outputPath = os.path.join(inputDirName, outputFileName) flatTargetPairsDict = getKerningPairsFromUFO.UFOkernReader( f_target, includeZero=True).allKerningPairs organizedSourceGroups = organizeGroups(f_source) newKerning = analyzeKerning(f_source, f_target, flatTargetPairsDict, organizedSourceGroups) transferGroups(f_source, f_target) f_target.kerning.clear()
from robofab.world import RFont font = RFont ('Morphologic.ufo') try: glyph = font ['percent'] except KeyError: glyph = font.newGlyph ('percent') pen = glyph.getPen() pen.moveTo((225,100)) pen.lineTo((225,150)) pen.lineTo((475,400)) pen.lineTo((525,400)) pen.lineTo((525,350)) pen.lineTo((275,100)) pen.closePath() font.save() pen = glyph.getPen() pen.moveTo((250,325)) pen.lineTo((225,350)) pen.lineTo((225,375)) pen.lineTo((250,400)) pen.lineTo((275,400)) pen.lineTo((300,375)) pen.lineTo((300,350)) pen.lineTo((275,325)) pen.closePath()
def allGlyphs(groups, spacer=None): allGlyphs = "" skip = ['invisible'] for groupName in groups.keys(): if groupName in skip: pass else: gNamesList = groups[groupName] allGlyphs += makeString(gNamesList, spacer) return allGlyphs def drawGlyph(gName, ufo_path, (x, y), context, _color=None, _scale=1): _ufo = RFont(ufo_path) _pen = NodeBoxPen(_ufo._glyphSet, context) _units_per_em = _ufo.info.unitsPerEm _units_per_element = 64 _ppem = _units_per_em / _units_per_element # draw glyph outline context.stroke(None) if _color is not None: context.fill(_color) else: context.fill(1, 0, .5, .3) g = _ufo[gName] context.push() context.transform(mode='CORNER') context.translate(x, y) context.scale(_scale)
def generate_base_fonts(data, italic): """Generate a list of RFonts with metadata loaded from .glyphs data.""" date_created = to_rf_time(data.pop('date')) family_name = data.pop('familyName') units_per_em = data.pop('unitsPerEm') version_major = data.pop('versionMajor') version_minor = data.pop('versionMinor') user_data = data.pop('userData', {}) copyright = data.pop('copyright', None) designer = data.pop('designer', None) designer_url = data.pop('designerURL', None) manufacturer = data.pop('manufacturer', None) manufacturer_url = data.pop('manufacturerURL', None) misc = ['DisplayStrings', 'disablesAutomaticAlignment', 'disablesNiceNames'] custom_params = parse_custom_params(data, misc) rfonts = {} master_id_order = [] for master in data['fontMaster']: rfont = RFont() rfont.info.familyName = build_family_name(family_name, master, 'width') rfont.info.styleName = build_style_name(master, 'weight', italic) rfont.info.openTypeHeadCreated = date_created rfont.info.unitsPerEm = units_per_em rfont.info.versionMajor = version_major rfont.info.versionMinor = version_minor if copyright: rfont.info.copyright = unicode(copyright.decode("utf-8")) if designer: rfont.info.openTypeNameDesigner = designer if designer_url: rfont.info.openTypeNameDesignerURL = designer_url if manufacturer: rfont.info.openTypeNameManufacturer = manufacturer if manufacturer_url: rfont.info.openTypeNameManufacturerURL = manufacturer_url rfont.info.ascender = master.pop('ascender') rfont.info.capHeight = master.pop('capHeight') rfont.info.descender = master.pop('descender') rfont.info.xHeight = master.pop('xHeight') horizontal_stems = master.pop('horizontalStems', None) vertical_stems = master.pop('verticalStems', None) if horizontal_stems: rfont.info.postscriptStemSnapH = horizontal_stems if vertical_stems: rfont.info.postscriptStemSnapV = vertical_stems set_redundant_data(rfont) set_blue_values(rfont, master.pop('alignmentZones', [])) set_family_user_data(rfont, user_data) set_master_user_data(rfont, master.pop('userData', {})) set_robofont_guidelines(rfont, master, is_global=True) set_custom_params(rfont, parsed=custom_params) # the misc attributes double as deprecated info attributes! # they are Glyphs-related, not OpenType-related, and don't go in info misc = ['weightValue', 'widthValue'] set_custom_params(rfont, data=master, misc_keys=misc, non_info=misc) master_id = master.pop('id') rfont.lib[GLYPHS_PREFIX + 'fontMasterID'] = master_id master_id_order.append(master_id) rfonts[master_id] = rfont return rfonts, master_id_order
def filterSelectionChanged(self, sender): selectedFilterName = self.getSelectedFilterName() self.cachedFont = RFont(showUI=False) self.currentFilterName = selectedFilterName self.updateControls() self.updatePreview()
exceptions = consolidateExceptions(flatExceptions, organizedSourceGroups) print 'building new kerning object ...' newKerning = {} newKerning.update(best_value_pairs) # print len(best_value_pairs) newKerning.update(exceptions) return newKerning ufoLib.UFOWriter = CustomWriter # subclassing UFO writer to use the writer contained in this script. f_source = Font(sys.argv[-2]) f_target = Font(sys.argv[-1]) # if f_target.lib['org.unifiedfontobject.normalizer.modTimes']: # del(f_target.lib['org.unifiedfontobject.normalizer.modTimes']) inputDirName, inputFileName = os.path.split(f_target.path.rstrip(os.sep)) outputFileName = inputFileName.replace('.ufo', '_mod.ufo') outputPath = os.path.join(inputDirName, outputFileName) flatTargetPairsDict = getKerningPairsFromUFO.UFOkernReader( f_target, includeZero=True).allKerningPairs organizedSourceGroups = organizeGroups(f_source) newKerning = analyzeKerning( f_source, f_target, flatTargetPairsDict, organizedSourceGroups) transferGroups(f_source, f_target) f_target.kerning.clear()
#!/usr/bin/env python # Script to generate the exclam, by Madlen Goehring from robofab.world import RFont font = RFont('Morphologic.ufo') glyph = font.newGlyph('exclam') pen = glyph.getPen() # ! Drawing instructions here ! # ! Otherwise nothing happens ! pen.moveTo((160,750)) pen.lineTo((340,750)) pen.lineTo((260,175)) pen.lineTo((235,175)) pen.closePath() pen.moveTo((210,125)) pen.lineTo((290,125)) pen.lineTo((310,90)) pen.lineTo((310,40)) pen.lineTo((290,0)) pen.lineTo((210,0)) pen.lineTo((190,40)) pen.lineTo((190,90)) pen.closePath() font.save()
def loadUfoFont(fontFile): if not file_exists(fontFile): sys.exit(error_messages['font_not_found'] + ' Supplied: ' + fontFile) else: return RFont(fontFile)
#for name in [glyph.name for glyph in font]: from robofab.world import RFont font = RFont("URWGothicL-Book-console.ufo") for glyph in font: if glyph.isEmpty() == False: pen = glyph.getPen() v = glyph.box[0] # entspricht x ganz links unten x = glyph.box[1] # entspricht y ganz links unten y = glyph.box[2] # entspricht x oben rechts z = glyph.box[3] # entspricht y oben rechts pen.moveTo((y,x)) pen.lineTo((y,z)) pen.lineTo((v,z)) pen.closePath() print glyph.box font.save()
#!/usr/bin/env python # Script to generate the Euro, by Jasmin Rathfelder from robofab.world import RFont font = RFont('Morphologic.ufo') try: glyph = font['onesuperior'] except KeyError: glyph = font.newGlyph('onesuperior') pen = glyph.getPen() pen.moveTo((600,0)) pen.lineTo((350,250)) pen.lineTo((250,250)) pen.lineTo((150,350)) pen.lineTo((250,350)) pen.lineTo((225,375)) pen.lineTo((250,400)) pen.lineTo((150,400)) pen.lineTo((250,500)) pen.lineTo((350,500)) pen.lineTo((600,750)) pen.lineTo((700,650)) pen.lineTo((550,650)) pen.lineTo((425,500)) pen.lineTo((575,500)) pen.lineTo((675,400)) pen.lineTo((375,400)) pen.lineTo((350,375))