Place stroke on a shape's contour, with no offset



  • Please, how can I achieve this? I need the stroke to go along letter's contour, not offsetted to be outside of the letter/shape. Thanks!



  • hello @jansindl3r,

    you can use the contours of the letters as a clipping mask, so the outside half of the stroke is not visible:

    size(2000, 1000)
    stroke(1, 0, 0)
    strokeWidth(30)
    
    B = BezierPath()
    B.text('a', (110, 130), fontSize=1400)
    
    # clip external stroke
    with savedState():
        clipPath(B)
        drawPath(B)
    
    # normal stroke
    translate(1000, 0)
    drawPath(B)
    

    clipStroke.png

    cheers!