コード例 #1
0
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')
コード例 #2
0
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')
コード例 #3
0
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()
コード例 #4
0
 def expand(self, sender):
     glyph = CurrentGlyph()
     
     defconGlyph = glyph.naked()
     
     glyph.prepareUndo("Outline")
     
     isQuad = curveConverter.isQuadratic(defconGlyph)
     
     if isQuad:
         curveConverter.quadratic2bezier(defconGlyph)
     
     outline = self.calculate(glyph)
     
     glyph.clear()
     outline.drawPoints(glyph.getPointPen())
     
     if isQuad:
         curveConverter.bezier2quadratic(defconGlyph)
     
     glyph.round()
     glyph.performUndo()