Page 1 of 1

text and layer size

Posted: January 29th, 2007, 7:54 am
by vranan
Hi,

Iam trying to link text to the width scale of a layer, so that no matter how many characters I type in the text layer the width of a solid underneath automatically adjust itself so the text appears centred in a box having the same margins left and right.

If anybody can help that would be greatly appreciated.

Many thanks,
Nino

Posted: January 30th, 2007, 1:11 pm
by lloydalvarez
AE does not report back the actual dimensions of a text layer. It gives the dimensions of the comp instead..

Here's a lengthy discussion on the subject:

viewtopic.php?t=150&start=0&postdays=0&postorder=asc


-Lloyd

Posted: January 30th, 2007, 1:26 pm
by Paul Tuersley
The only alternative I can think of is to set the width based on the number of characters in the text layer. It won't be accurate, but at least it's easy. Here's an expression you'd add to the Scale property of the underlying solid.

Code: Select all

numOfChars = thisComp.layer("MyTextLayer").text.sourceText.length;
[numOfChars * 40, value[1]];
In that example, I'm finding the number of characters on the text layer "MyTextLayer" and multiplying by 40 to calculate the X Scale value. You would change the 40 value, depending on the size of your text.

Posted: January 31st, 2007, 7:18 am
by vranan
Thanks Paul, that will do the trick for the moment and also thanks lloydalvarez this is exactly what I was looking for...