def mergeSelectedPointsInGlyph(rfglyph, updateControlPoints): rfglyph.prepareUndo("Merge Points") glyph = TFSGlyph(rfglyph) glyphName = hex(glyph.unicode) if glyph.unicode is not None else '<None>' paths = glyph.getContours(setSelected=True) paths = processGlyph(glyph, glyphName, paths, updateControlPoints) if paths is not None: glyph.setContours(paths) ## tell the glyph you are done with your actions so it can handle the undo properly rfglyph.performUndo()
def performAlign(alignFunction): try: rfglyph = CurrentGlyph() if rfglyph is None: #raise Exception('No current font.') return rfglyph.prepareUndo("Align Glyph") glyph = TFSGlyph(rfglyph) glyphName = hex( glyph.unicode) if glyph.unicode is not None else '<None>' print 'processing', glyphName paths = glyph.getContours(setSelected=True) paths = alignFunction(paths) glyph.setContours(paths) #if index > 5: # break glyph.update() font.update() ## tell the glyph you are done with your actions so it can handle the undo properly rfglyph.performUndo() except Exception, e: from robofab.interface.all.dialogs import Message as Dialog Dialog(e.message, title='Error')
def alignGlyphTangents(curvify, onlySelected): rfglyph = CurrentGlyph() if rfglyph is None: raise Exception('No current glyph.') rfglyph.prepareUndo("Align Tangents") glyph = TFSGlyph(rfglyph) glyphName = hex(glyph.unicode) if glyph.unicode is not None else '<None>' paths = glyph.getContours(setSelected=True) paths = processGlyph(glyph, glyphName, paths, curvify=curvify, onlySelected=onlySelected) glyph.setContours(paths) ## tell the glyph you are done with your actions so it can handle the undo properly rfglyph.performUndo()
def performAlign(alignFunction): try: rfglyph = CurrentGlyph() if rfglyph is None: #raise Exception('No current font.') return rfglyph.prepareUndo("Align Glyph") glyph = TFSGlyph(rfglyph) glyphName = hex(glyph.unicode) if glyph.unicode is not None else '<None>' print 'processing', glyphName paths = glyph.getContours(setSelected=True) paths = alignFunction(paths) glyph.setContours(paths) #if index > 5: # break glyph.update() font.update() ## tell the glyph you are done with your actions so it can handle the undo properly rfglyph.performUndo() except Exception, e: from robofab.interface.all.dialogs import Message as Dialog Dialog(e.message, title='Error')
def cleanupGlyphContours(glyph): glyph = TFSGlyph(glyph) glyphName = hex(glyph.unicode) if glyph.unicode is not None else '<None>' paths = glyph.getContours(setSelected=True) paths = processGlyph(glyph, glyphName, paths) glyph.setContours(paths)