AppendBPoint outputs NotImplementedError

  • Is there a tutorial or some help on how to add points on an existing contour?
    appendBPoint outputs NotImplementedError.

  • hi frederik,
    that is a great help. segments obviously come along with some points.
    thanks a lot!

  • admin

    To draw in a glyph use a pen like object
    To add or insert points use appendSegment or insertSegment

    glyph = CurrentGlyph()
    ## grab the pen of that glyph
    pen = glyph.getPen()
    ## draw with the pen
    ## this draws a rect
    pen.moveTo((100, 100))
    pen.lineTo((100, 200))
    pen.lineTo((200, 200))
    pen.lineTo((200, 100))
    ## grab the first contour
    contour = glyph[0]
    ## append a segment
    contour.appendSegment("line", [(150, 50)])
    ## insert a segment
    contour.insertSegment(2, "line", [(50, 200)])
    contour.insertSegment(3, "curve", [(100, 280), (200, 280), (250, 200)])

Log in to reply