A simple character set proofer using the DrawBot extension in RoboFont.

All glyphs are displayed side-by-side following the order defined in the f.glyphOrder attribute. You can adjust some basic parameters such as the page margin, and size/spacing of the glyph boxes.

'''Character Set Proofer'''

f = CurrentFont()

# main variables
boxHeight = 70
boxPaddingX = 0
boxPaddingY = 20
margin = 30

# calculate scale
s = float(boxHeight) / f.info.unitsPerEm

# define page size
size('A4Landscape')
pageWidth, pageHeight = width(), height()

# calculate initial positions
x = margin
y = pageHeight - margin - boxHeight

# draw glyphs
xBox, yBox = x, y
for i, glyphName in enumerate(f.glyphOrder):

    g = f[glyphName]
    boxWidth = g.width*s

    # jump to next line
    if xBox + boxWidth >= pageWidth - margin:
        xBox = x
        yBox -= boxHeight + boxPaddingY
        # jump to next page
        if yBox < margin:
            yBox = y
            newPage(pageWidth, pageHeight)

    # draw glyph cell
    stroke(1, 0, 0)
    fill(None)
    rect(xBox, yBox, boxWidth, boxHeight)

    # draw glyph
    xGlyph = xBox
    yGlyph = yBox - f.info.descender*s
    save()
    translate(xGlyph, yGlyph)
    fill(0)
    stroke(None)
    scale(s)
    drawGlyph(g)
    restore()

    # move to next glyph
    xBox += boxWidth + boxPaddingX

Last edited on 26/09/2018