Tuesday, March 13, 2012

Flow Text box to fit contents

A few days ago, Johan Ronsse requested a script that expands a text area's size to match it's containing text when some of the text is hidden by overflow.   I realized the utility of such a script, but after checking illustrator's API, I could find no native way to do it.  A few hours later, Johan sent me this link.

Nathaniel Kelso found a way to make it work.  Nathaniel's script used a really cool trick in which he grows the container, then makes a copy of the text, and flattens the text into geometry. Once the text has become a collection of graphic objects, it becomes trivial to get it's correct size. The script then deletes the geometry, and re-sizes the original text box to the correct dimensions. Brilliance!!!

Download it... Use it, and remember to send Nathaniel a thank you if you use it.
For me this was a great reminder that if you're against a wall, ask someone else.  There are always so many creative ways to solve a problem.
Stay inspired!!!


Wolf said...

Thanks John. I made a little screencast on how it works:


John said...

Cool, thanks for the link!