Page 1 of 1
Textheight
Posted: Sat Dec 10, 2016 2:48 pm
by teacherguy
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.
Re: Textheight
Posted: Sat Dec 10, 2016 3:41 pm
by jmburnod
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
Re: Textheight
Posted: Sat Dec 10, 2016 5:01 pm
by FourthWorld
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.
Re: Textheight
Posted: Sat Dec 10, 2016 5:21 pm
by jacque
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.
Re: Textheight
Posted: Sat Dec 10, 2016 10:31 pm
by teacherguy
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.
Re: Textheight
Posted: Sun Dec 11, 2016 6:05 pm
by jacque
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.
Re: Textheight
Posted: Sun Dec 11, 2016 9:24 pm
by teacherguy
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.
Re: Textheight
Posted: Sun Dec 11, 2016 10:14 pm
by jacque
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.
Re: Textheight
Posted: Mon Dec 12, 2016 12:14 am
by teacherguy
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.
Re: Textheight
Posted: Mon Dec 12, 2016 6:42 pm
by teacherguy
You're a rock star, thank you Jacque!