Using DrawBot as a module ↩
DrawBot can also be used as Python module, without the UI: we can import the drawBot
module into a script and use it to generate images.
This works outside of RoboFont too, if the DrawBot module is installed in the system’s Python.
The example below creates a new image and saves it as a PDF in the Desktop folder.
import os
from drawBot import *
# draw something
newDrawing()
size('A4Landscape')
fill(1, 0, 0)
fontSize(120)
rotate(5)
text('hello world!', (100, 200))
# make image path
folder = os.path.expanduser('~/Desktop')
imgPath = os.path.join(folder, 'hello.pdf')
# save image
saveImage(imgPath)