Skip to main content
Known Participant
August 31, 2010
Question

Question on textFlow.flowComposer.getLineAt function

  • August 31, 2010
  • 1 reply
  • 925 views

Hi all - Is there any condition under which textFlow.flowComposer.getLineAt will not give you a correct value? For a particular text area, textFlow.flowComposer.numLines is coming as 2. I need a logic to compute gap between the 2 lines. when I check textFlow.flowComposer.getLineAt(1).y and textFlow.flowComposer.getLineAt(0).y .. both return the same value. I know its weird but am not able to figure out why is it not working correctly.

Pls let me know what could I be doing wrong? Is there any other way to compute textgap between 2 lines? Pls let me know if you need more information. Its kind of urgent.

Thanks & Regards,

Magesh

This topic has been closed for replies.

1 reply

August 31, 2010

Did you check the validity of that second text line?  I'm guessing that maybe it's invalid, meaning lines at index 1+ have not been composed yet (or need to be composed).

Before you make your getLineAt() calls, you could try calling flowComposer.composeToPosition() without any arguments, which should force immediate composition of the whole text flow.  You can get away with doing that for a small textflow, but it could cause issues with lots of content.

MageshRAuthor
Known Participant
September 1, 2010

Yes. As you had said, flowComposer.getLineAt(1).validity came out as invalid. I tried textFlow.flowComposer.composeToPosition(); before doing number of lines calculation and lineheight calcuation but in vain. It still returns invalid.

Is there any other way to compute textgap b/w 2 lines in a textflow?