-
Get number of wrapped lines from some paragraph text
Hello,
I have used the expression (below – which I think I got from this site, from one of the expression geniuses) to get the number of lines in a chunk of text by counting the number of “newline” characters (\ron Mac OS X). But if I have a chunk of paragraph text, with wrapped lines, this will not work. I’ve tried using\ninstead, which I’ve read is the “newer” carriage return character for Mac OS X but this always just returns “1” regardless of the text.I’m trying to align a shape layer’s y-position with each new line – similar to bullet points:
- This is the first bullet of text.
- This is the second. The bullets always stay with the first line regardless of how much the chunk of text has wrapped, even if it goes over several lines.
- And more text….
Any suggestions, anyone?
Thanks,
Paul
textLayer = thisComp.layer("body text");
newLineChar = "r";
newLines = 0;
for( i = 0 ;
i < textLayer.text.sourceText.length; i++ )
{
if( textLayer.text.sourceText.charAt( i ) == newLineChar)
{
newLines++;
}
}
newLines+1