예제 #1
0
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()
예제 #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')
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')
예제 #5
0
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)