appendBPoint outputs NotImplementedError

RoboFont Forums Help / General appendBPoint outputs NotImplementedError

This topic contains 2 replies, has 2 voices, and was last updated by  jo 2 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5182

    jo
    Participant

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

    #5183

    frederik
    Keymaster

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

    glyph = CurrentGlyph()
    glyph.clear()
    ## 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))
    pen.closePath()
    
    ## 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)])
    
    
    #5185

    jo
    Participant

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

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.