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:
Draw a blue background measuring 4 by 3 inches. (code)
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)
Using preset margins, calculate the available space in the yellow box. (code)
If the participant has provided a company name, allot some available space for that at the bottom. (code) Then print the company name. (code)
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)
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)
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)
If the total text block is shorter than the available space, center it vertically in the available space. (code)
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)
Now, draw the text block. Draw each word of the name at the calculated font size, separated by the calculated line spacing. (code)
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)
That’s it! Have fun attempting to read everyone’s names, and enjoy the conference!