the number of ACTUAL lines in a field?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
the number of ACTUAL lines in a field?
I know I can get the lines of a field, which tells me how many return-delimited chunks of text there are. But is there a way to determine the 'effective' lines of a field? Say I have one string with no returns in the middle, but it's long enough to linewrap into three 'effective', visual lines. (A bit like this post!) Can I find this out through scripting?
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: the number of ACTUAL lines in a field?
Replying to my own question *again*... 
Seems that the textHeightSum tells me the total height of the lines of text in pixels. Finding the 'effective textHeight' of the field tells me the line spacing, I can work out the number of visual lines from that, with a bit of sanity checking to CMA.

Seems that the textHeightSum tells me the total height of the lines of text in pixels. Finding the 'effective textHeight' of the field tells me the line spacing, I can work out the number of visual lines from that, with a bit of sanity checking to CMA.

Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: the number of ACTUAL lines in a field?
That's not quite what I was playing towards (a more accurate phrase than "working towards") but it's a great example for a related process. Thanks!
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: the number of ACTUAL lines in a field?
Hi Keith,
isn't the formattedText what you are looking for?
Suppose you have text in a field that has it dontWrap set to false, i.e. the text wraps. You want to know how many visual lines are in the field
or I am not getting it.
Kind regards
Bernd
isn't the formattedText what you are looking for?
Suppose you have text in a field that has it dontWrap set to false, i.e. the text wraps. You want to know how many visual lines are in the field
Code: Select all
put the formattedText of field "x" into tTemp
put the number of lines of tTemp
Kind regards
Bernd
Re: the number of ACTUAL lines in a field?
Rereading your original post (why is there always time to do that but never time to do so in the first place?) Bernd's suggestion is just what you wanted. He gets it.
Craig
Craig
Re: the number of ACTUAL lines in a field?
Of course it's an easy one-liner too, no two-step process needed:
Thanks!
Code: Select all
put the number of lines of the formattedText of field "blurb"
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist