Page 1 of 1

Calculate number of lines in paragraph text

Posted: November 9th, 2007, 6:29 pm
by yuppster
I've got a 'Paragraph Text' text block... and need to figure out how many lines the paragraph contains.

I know if it was 'Point Text' I could do something like txt.split("\r"); but it's got to remain paragraph text. Any ideas?

Posted: November 10th, 2007, 11:38 am
by Mylenium
Not really. Doing this would require to access the glyph bounding box sizes, kerning and spacing parameters which is not possible. If you know the bounding box size of each letter at a given point size, you could use the sourceRectAtTime() method and add them all together, but it would still be a guesstimate rather than a correct calculation.

Mylenium

Posted: November 10th, 2007, 11:05 pm
by yuppster
Okay, that's kind of what I suspected. Thanks for your insight Mylenium.

Posted: November 12th, 2007, 6:29 am
by Atomic
You could always just read the text from a file, then assign it to a layer.

Then you would know how many lines of text you created.

Of course, you can not create paragraph text via jsx code in AE7. CS3 , I don't know?