Create Template for drawing glyphs

Is it possible to create template sketch glyphs from the list of glyphs.

What do you mean?

I want to create PDF, one glyph per page, with the grid box and a grey letter in the background to sketch on it

You can do that with a dropbox script. Install the DrawBot plugin and put that into the code view:

from GlyphsApp import *
size('A4')
padding = 50
pageHeight = height() - (2 * padding)
pageWidth = width()
print(pageHeight)
for g in Glyphs.font.glyphs:
    print(g)
    newPage()
    layer = g.layers[0]
    ascender = layer.ascender
    descender = layer.descender
    width = layer.width
    scale = pageHeight / (ascender - descender)
    fill(None)
    stroke(0, 0, 0, 1)
    strokeWidth(0.1)
    rect((pageWidth - (width * scale)) / 2, padding, width * scale, pageHeight)
    
    path = BezierPath(layer.completeBezierPath)
    path.scale(scale)
    path.translate((pageWidth - (width * scale)) / 2, padding - (descender * scale))
    fill(0, 0, 0, .3)
    stroke(None)
    drawPath(path)

saveImage("~/Desktop/drawBotTest.pdf")
3 Likes

Error.
ascender is defined in the font. but script is not able to pick it up.

image

This is only available in the latest version. Please update to the latest cutting edge version.

image
I have version 2.6.6 cutting edge.

Ha, I was speaking about Glyphs 3. You are right, in Glyphs 2, those properties are only on the master.

with cutting edge glyphs3

image

It sounds like at least one of the Python modules DrawBot requires is not installed, possibly pyobjc.

In Glyphs 3, one can select which Python 3 installation to use in Glyphs > Preferences… (Command-comma) > Addons. It is also possible to install a verison of Python 3 that includes some of the typical modules used via Window > Plugin Manager > Modules. If you do so, you may need to then select it in Preferences > Addons.

Hope that helps.

image
image

Still same error running Drawbot plugin

@GeorgSeifert Could you please look into this error

I need to test this more but for now, install python from the python.org. Then run this in the terminal: pip3.9 install pyobjc. Then select the python.org python in Preferences > Addons.

Done.

Now glyphs 3 doesn’t open, after I changed the addons to python.org (3.9.0)

Its crashing everytime.

Then remove the plugins from the plugins folder. Or start the with Option+Shift key pressed.