Textheight

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Textheight

Post by teacherguy » Sat Dec 10, 2016 2:48 pm

I understand that if I set the fixedlineheight of a field to false and then use a different textsize on different lines of a field that LC will automatically adjust the "white space" between the top of text and the text on the line above.

But....can I further alter this whitespace if I so choose? I cannot find a way.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Textheight

Post by jmburnod » Sat Dec 10, 2016 3:41 pm

Hi teacherguy,
Interesting,
I played with your goal using textheight
Unfortunately we can't get the textheight of a line
Same with "effective textheight"
Best regards
Jean-Marc
https://alternatic.ch

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Textheight

Post by FourthWorld » Sat Dec 10, 2016 5:01 pm

With v5.5 and later LiveCode offers a range of text formatting features nearly unmatched in other multi-platform scripting languages. The problem is there are so many it's hard to keep track of them all. :)

The Dictionary can be filtered by "field" to get a list of field-related tokens, but that's a lot to sift through.

You'll want to look at the spaceAbove, spaceBelow, and padding text properties.

I have a request to enhance the User Guide's discussion of fields to include more thorough coverage of the new features, but in the meantime the Release Notes for v5.5 provide a good overview:
http://downloads.livecode.com/livecode/ ... -5_5_5.pdf

See the section there on "Paragraph level properties".

And although unrelated to your original request, it may also be useful to quickly skim the section on "Ordered and Unordered Lists", in case you may need those later on.

In one of my apps I use almost every field property LiveCode supports, and they've been wonderful in allowing me to tailor textual presentation.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Textheight

Post by jacque » Sat Dec 10, 2016 5:21 pm

If "spaceAbove" doesn't work with a false fixed line height, you may need to set it to true, calculate the amount of space you need, and set it in the script. I haven't tried that, so the text may get cropped anyway but it's worth a try.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Textheight

Post by teacherguy » Sat Dec 10, 2016 10:31 pm

Thanks all. At first attempt it seems correct that the fixed height needs to be set to true. However, after that it also seems that only positive integers for spaceabove/spacebelow have an effect. In other words, I do not seem to be able to decrease the space between one line and the next, though I can increase the space.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Textheight

Post by jacque » Sun Dec 11, 2016 6:05 pm

Typically you'd set the textHeight to the spacing you want for the main body text and add spaceAbove/below to the exceptions.

It might help to see some example text of what you want to do.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Textheight

Post by teacherguy » Sun Dec 11, 2016 9:24 pm

A simple example would be:

field line 1 at textsize 40
field line 2 at textsize 35
field line 3 at textsize 30
field line 4 at textsize 25

And then I would like the ability to address the space above lines 2 through 4 so as to close up that space in its entirety if I choose.
Last edited by teacherguy on Mon Dec 12, 2016 12:13 am, edited 1 time in total.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Textheight

Post by jacque » Sun Dec 11, 2016 10:14 pm

Okay. Use a fixedLineHeight of the smallest textsize: 25
Set the margins of the field to something large enough to avoid cropping the top, like 20
Set the spaceBelow of line 1 to 10
Set the spaceBelow of the other lines to 2 or 3

Adjust as needed.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Textheight

Post by teacherguy » Mon Dec 12, 2016 12:14 am

Aha. I was thinking that one removes the space above and below but the way you've explained it one adds the space. Makes sense. I'll give it a go, thanks so much.

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Textheight

Post by teacherguy » Mon Dec 12, 2016 6:42 pm

You're a rock star, thank you Jacque!

Post Reply