text and layer size

Moderators: Disciple, zlovatt

Post Reply
vranan
Posts: 13
Joined: February 8th, 2005, 9:53 am
Contact:

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
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

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
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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.
vranan
Posts: 13
Joined: February 8th, 2005, 9:53 am
Contact:

Thanks Paul, that will do the trick for the moment and also thanks lloydalvarez this is exactly what I was looking for...
Post Reply