Apparent rather than literal line count

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

Apparent rather than literal line count

Post by thatkeith » Wed Sep 21, 2016 5:02 pm

Is there a way to find out how many wrapped lines there are in a field? Not the logical lines (return-delimited), but the way the text looks to a human when it line-wraps in a text field.
I'd like to be able to work out, programmatically, how much height a given chunk of text takes when it's in a particular font, type size and line height.

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Apparent rather than literal line count

Post by Klaus » Wed Sep 21, 2016 5:23 pm

Hi Keith,

do something like this:
...
put the number of lines of THE FORMATTEDTEXT of fld "your field here"
...

Best

Klaus

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 383
Joined: Mon Mar 01, 2010 7:13 pm
Contact:

Re: Apparent rather than literal line count

Post by thatkeith » Wed Sep 21, 2016 6:07 pm

That's brilliant! Thanks Klaus – I had a vague memory of there being some solution but I didn't manage to track it down in the dictionary. (I have to say I still really dislike the new-look LC dictionary. :( )
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Post Reply