ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Scaling text to text box expression

COW Forums : Adobe After Effects Expressions

Respond to this post   •   Return to posts index   •   Read entire thread

Kalle Kannisto
Re: Scaling text to text box expression
on Aug 3, 2016 at 12:02:01 pm
Last Edited By Kalle Kannisto on Aug 3, 2016 at 12:14:31 pm

It's a pretty convoluted matter.

The attached project is the best I've managed to do thus far. It reflows the text (breaking between words) so that the text area becomes approximately the same shape as the rectangle and then scales the resulting text area to fit into the rectangle. As long as the type is all the same formatting, it works pretty good.

There are two slider controls on the text layer:

1. "margin" for how much margin there is between the edge of the text box and the text.

2. "leading ratio" which needs to be adjusted if you change the typeface, leading or other character formats. It is used to tell the reflow expression what the average height to width ratio for one letter is, including the leading (line spacing). If you get too much empty space at the right or at the bottom, adjust this setting.

Easy way to see how this works: Resize the rectangle from the bottom right corner. (Note: If you make the text box very thin and tall, the end of the text will be missing. To fix that, make the original text box taller with the type tool.)

Posts IndexRead Thread 

Current Message Thread:

© 2019 All Rights Reserved