Skip to main content
Inspiring
October 24, 2013
Answered

Calculate length of text lines

  • October 24, 2013
  • 1 reply
  • 876 views

In a script, I am inserting text that is a 4-line poem. Each line except the last ends with a hard return ("\n"). I would like to calculate the length (in inches or some other length unit) of each individual line to find the longest line and adjust the left indent accordingly. Is it possible to get the length of a line of text in a script?

Thanks!

This topic has been closed for replies.
Correct answer Eugene Tyson

A hard return is \r

\n is a soft return

Have a look through the comments here

http://indesignsecrets.com/setting-poetry-flush-left-center-on-longest-line.php

1 reply

Eugene TysonCommunity ExpertCorrect answer
Community Expert
October 24, 2013

A hard return is \r

\n is a soft return

Have a look through the comments here

http://indesignsecrets.com/setting-poetry-flush-left-center-on-longest-line.php

Dan-BTPAuthor
Inspiring
October 24, 2013

Yes, I used the wrong term. I'm using the soft return character at the end of my poem stanza lines.

The horizontalOffset method of determining line length, based on the starting and ending characters, worked well for me. Thanks for the suggestion!