picture of someone wearing a badge?

BadgeBot

Generating the Typographics Badges

by David Jonathan Ross


The Typographics badges were made in less than a day using Drawbot, an excellent Python-based app for creating graphics. I automated them based on a static design by Nick Sherman. The design employs Stilla SH as well as a guest appearance by my in-progress typeface.

Check out the code on github. Pretty much, the process went as follows:

blue background
Draw a blue background measuring 4 by 3 inches. (code)
blue background
Draw a yellow box inside of it. Create jaggy edges by drawing a random number of points on each edge, and allowing the positions of those points to vary a certain amount within the space. No two jaggy-edged boxes are alike (compare the front and back of a name card to verify!) (code)
available space
Using preset margins, calculate the available space in the yellow box. (code)
company name
If the participant has provided a company name, allot some available space for that at the bottom. (code) Then print the company name. (code)
name split
Ignore the badge layout for a moment and focus on the name. Split the name into lines, using spaces and hyphens as delimiters. Get rid of the spaces, but don’t get rid of the hyphens. (code)
calculations
For each line, calculate the font size that will let the word fill the available space. If the word is too short, set a maximum font size. Don’t draw this word yet...this is just a dress rehearsal. We need to figure out the dimensions of the whole text block before we can print anything. (code)
descender
Also, account for a given amount of space between each line. If the word has a descender, make a note that we should add a little more space beneath that line. Keep track of the height of the total text block that we are building. (code)
tall name
If the total text block is shorter than the available space, center it vertically in the available space. (code)
short name
If the total text block is taller than the available space, scale it down until it fits, and center it horizontally in the available space. (code)
short name
Now, draw the text block. Draw each word of the name at the calculated font size, separated by the calculated line spacing. (code)
sheet
Make one of these for each participant. (code) For printing, make six to a page (or three two-sided sheets, to be folded over), along with some margins and crop marks. (code)
animate
That’s it! Have fun attempting to read everyone’s names, and enjoy the conference!