How to draw an unclosed path with drawbot-plugin?

How to draw an unclosed path with drawbot-plugin?

It depends on what kind of path do you mean.

Do you mean drawbot-path that will be only displayed in the drawbot-plugin’s window or you want to draw GSPath (in other words path, which would be drawn as a part of the letter, editable with other Glyphs tools)?

I made quick, explanatory drawbot script for drawing open/closed paths.

# setting fill to None makes shapes "hollow"
fill(None)

# by default stroke is set to None, let's set it to some color, so it will draw visible curves and lines
stroke(0,0,1,1)

# there are few ways of drawing paths in DrawBot,
# my favourite is creating BezierPath object
path = BezierPath()

# to draw paths in the DrawBot you use methods
# described as a "PEN PROTOCOL"
# - it is a standard in which a lot of type related
# libraries are drawing shapes
# https://fonttools.readthedocs.io/en/latest/pens/basePen.html
path.moveTo((10,10))
path.lineTo((10,510))
path.lineTo((510,510))
path.curveTo((710,510), (710,10), (510,10))

# in the end if you want to draw something
#, you will need to pass the path instance
# to function called "drawPath"
drawPath(path)

# as you can see, this path is opened

# now lets make closed version
# I will redo our path object on new page

newPage()
fill(None)
stroke(0,0,1,1)

path = BezierPath()
path.moveTo((10,10))
path.lineTo((10,510))
path.lineTo((510,510))
path.curveTo((710,510), (710,10), (510,10))

# this time I will close the path
path.closePath()

drawPath(path)

Maybe you haven’t set fill to None, by calling function fill(None)

1 Like

Thank you. I really forgot to fill(None)

1 Like