A long time ago, I wrote a cfc for wrapping and scaling image text to fit within a given set of dimensions. I always thought it was something better done in java. Well, I finally got around to creating a java version, and it is a lot simpler to use. I also improved the algorithm used to auto-scale the text, and may write up an entry on that later. Plus I finally added support for line breaks (left-to-right text only).
Alignment: Supports left, right or center alignment
Antialiasing: Enable or disable text anti-aliasing
AutoScale: Enlarge or reduce text size to best fit the text within the given area
DrawText: Enable or disable text drawing (Could be used for measuring only)
Font: Supports custom font name, style or size
Color: Supports custom text color
Ignore Margin: (Experimental) Ignores top and bottom padding on first/last line of text for a better text fit
Increment: Supports fractional font sizes and custom incrementing
It works very well for small to moderate amounts of text. Out of curiosity, I did test it with about 62,000 characters. (Crazy, I know). While it did work, it took a while. So if you are thinking of trying to calculate the font size needed to print War and Peace on a matchbook cover, think again. It is just not designed for that kind of volume.
Anyway, I tried to make the library as flexible as possible. So for example, you could wrap text without auto-scaling. You could also get the measurements of the wrapped text without actually drawing it onto your image. (I am not sure there is a need for this. But if you wanted to do it, you could!).
Next up, I am thinking of wrapped text with mixed styles (...I do love a challenge)
Update 2009-12-22: Fixed wrong file version in source