Skip to content

Instantly share code, notes, and snippets.

@justvanrossum
Created April 16, 2020 19:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justvanrossum/443186a8b06d9eb9e6463e94b91630e3 to your computer and use it in GitHub Desktop.
Save justvanrossum/443186a8b06d9eb9e6463e94b91630e3 to your computer and use it in GitHub Desktop.
MEHRINGDAMM: Spacing by bounding box
# Image from https://twitter.com/Berlin_Type/status/1250742042004766730
imagePath = "MEHRINGDAMM.jpeg"
w, h = imageSize(imagePath)
size(w, h)
with savedState():
rotate(0.1)
image(imagePath, (0, 0), 0.6)
spacing = 25.5
pointSize = 126
translate(60.2, 354)
t = "MEHRINGDAMM"
fill(1, 0, 0.2, 0.5)
for c in t:
bez = BezierPath()
bez.text(c, font="Arial Bold", fontSize=pointSize)
xMin, yMin, xMax, yMax = bez.bounds()
bez.translate(-xMin, -yMin)
drawPath(bez)
translate(xMax - xMin + spacing, 0)
saveImage("MEHRINGDAMM_BOXED.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment