During the day, I spend a lot of my time typesetting and adding corrections to manuscripts. Now and then I get a brief for a cover, but for the most part what I do is the meat and potatoes of graphic design - balancing margins, making sure that things flow well and don't look weird. It's often fiddly and frustrating and I love it.
All this has perhaps made me think about the fundamentals of typography and wondering how exactly the things I take for granted actually work. Take flush justification, for example. It's been a feature of almost every word processor I've ever used (apart from Easi-Amsword that came bundled with my Amstrad CPC 464, that didn't even have word wrap and made you press return at the end of every line). It's one of those things that you just take for granted. (Although it should be noted that there's a trend at the moment for no-frills text editors and I'm not immune. I use iA Writer to write blog posts, but that's only because Squarespace's app is borked on iOS. They do all have word wrapping, though...).
It's only when you take something apart and try and put it back together that you realise just how complex something can be. That being said, the solution is usually quite simple and elegant. I'm still very early in my programming adventures, though, so it usually takes a lot of wrong turns for me to find it. When I get frustrated, I find that I just throw variables together, hoping that they'll do what I want. They never do, but sometimes the results are quite interesting. Usually, just stepping away from the problem allows the solution to present itself.
Anyway, I was trying to find a way to space a word so that it would fit inside a specifically defined space, with the characters placed in an equidistant and aesthetically pleasing way. This began mainly as a way to make my triangle wave text more regular, but it turns out that it works as a regular flush justification routine as well. It only works one line at a time, though, so you still have to separate the lines of your paragraph manually. It's like being back on Easi-Amsword... At least until I can work out how to program a word-wrap function.
I still haven't worked out how to integrate processing into Squarespace, so the example below is embedded from openprocessing.org. Also, I've added an animation loop to demonstrate that the characters are evenly spaced, no matter how long the line. Also, I can't get fonts to embed, so I've got to use Courier.