This post used to be on Posterous. I rescued my posts before Posterous shut down and am now sharing them here.
Ok, this is kind of fun, even though the code is very naive.
I've added a height-check at the end of my line-breaking code. If there are too many lines of text to fit within the allowed space, the algorithm will rescale everything and try again:This isn't great for real-time text flow, but it is fine for fitting text, I think.