Skip to content

Instantly share code, notes, and snippets.

@eduairet
Created June 10, 2020 18:38
Show Gist options
  • Save eduairet/ef1e34745fdd730a37d67a1fdbeda53f to your computer and use it in GitHub Desktop.
Save eduairet/ef1e34745fdd730a37d67a1fdbeda53f to your computer and use it in GitHub Desktop.
Script to generate with DrawBot a grid to practice blackletter calligraphy
'''
Blackletter grid generator
Generador de retícula para letra gótica
-
Eduardo Aire Torres 2020
'''
# Size of your pen / Tamaño de tu pluma
mmPen = 7 # Size in mm / Tamaño en mm
pen = mmPen * 2.83465 # Transform to points / Transforma a puntos
# Set your page's margin / Prepara el margen de tu página
marginTop, marginBottom, marginLeft, marginRight = 5 * 2.83465, 10 * 2.83465, 5 * 2.83465, 5 * 2.83465
# Line setting / Creación de renglón
lines = [
2, # Ascender line / Línea de las ascendentes
4, # X base / Base de x
1.5, # Descender line / Línea de las descendentes
0.5, # Space between lines / Espacio entre renglones
]
fullLine = 0
for eachLine in lines:
fullLine += eachLine * pen
def writtingLine():
stroke(0)
strokeWidth(0.5)
lineSize = 0
while lineSize < height() - marginBottom:
for eachLine in lines:
with savedState():
translate(0, -lineSize)
line(
(marginLeft, height() - marginTop),
(width() - marginRight, height() - marginTop)
)
lineSize += eachLine * pen
if lineSize + fullLine > height() - marginBottom:
break
verticalLines = 0
while verticalLines < width() - marginRight - marginLeft:
lineDash(4, 4)
with savedState():
translate(verticalLines, 0)
line(
(marginLeft, height() - lineSize),
(marginLeft, height() - marginTop)
)
if width() > height():
verticalLines += (width() - marginRight - marginLeft) /12
else:
verticalLines += (width() - marginRight - marginLeft) /6
line(
(width() - marginRight, height() - lineSize),
(width() - marginRight, height() - marginTop)
)
# Setting the page / Preparando la hoja
def blackletterGrid(size):
newPage(size)
lineSize = 0
while lineSize < height() - marginBottom:
for eachLine in lines:
lineSize += eachLine * pen
if lineSize + fullLine > height() - marginBottom:
break
stroke(None)
lineDash(None)
font("ProximaNova-Regular", 6)
fallbackFont('Helvetica')
text("Eduardo Aire Torres 2020", (marginLeft, marginBottom/2))
with savedState():
translate(0, -(height() - marginBottom - lineSize) / 2)
writtingLine()
# Export and reset / Exportar y resetear
saveImage('~/Desktop/blackletter_grid_{0}_{1}_mm.pdf'.format(size.lower(), mmPen))
newDrawing()
# Design your pages / Diseña tus páginas
blackletterGrid(size = 'TabloidLandscape')
blackletterGrid(size = 'Tabloid')
blackletterGrid(size = 'Letter')
blackletterGrid(size = 'LetterLandscape')
# eduairet.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment