A small example with a pen saving to a ufo file
from fontParts.world import RFont
# create a font object
myFont = RFont(showInterface=False)
# create a glyph object
myGlyph = myFont.newGlyph("a")
# get the pen
myPen = myGlyph.getPen()
# draw into the pen, similar as a DrawBot BezierPath
myPen.moveTo((100, 100))
myPen.lineTo((100, 200))
myPen.lineTo((200, 200))
myPen.lineTo((200, 100))
myPen.closePath()
# using a bezierPath
myPath = BezierPath()
# draw into the bezierPath
myPath.oval(10, 10, 50, 50)
myPath.text("Hello World", (60, 10))
# draw the bezierPath into the glyph pen
myPath.drawToPen(myPen)
# save the ufo
myFont.save("path/to/save.ufo")
# get a bezierPath
path = BezierPath()
# draw the glyph into the bezierPath
myGlyph.draw(path)
# draw the bezierPath
drawPath(path)
with DrawBot as a RoboFont extension you can also just draw into a glyph as a context, similar as drawing into a pdf, png, gif, ...
# run this RoboFont with the DrawBot extension
oval(10, 10, 100, 100)
text("Hello World", (110, 10))
# 'a(background).glyph'
saveImage("a.glyph")