Is there any way to find out the default distance between the lines in a wrapped text?
I'm making the text box, which size depends on the width and the number of lines of the text.
In order to calculate the required height of the box, I use the following formula:
Number_of_lines*Font_size+(Number_of_lines-1)*line_break_size+Margins
I know the number of lines due to Font:getWrap, I certainly know the font size I'm using and I set the 10px margins from each side.
But what is the line break size?
What is the default line break size?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: What is the default line break size?
I think [wiki]Font:getHeight[/wiki] includes this, too.
Re: What is the default line break size?
Nope, unfortunately. Whenever I have 1 or two lines the height is still 14 (with 12 size font)bartbes wrote:I think [wiki]Font:getHeight[/wiki] includes this, too.
Re: What is the default line break size?
Probably that's because this is font's height, not rendered text one's. If you know exactly how many rows you have, multiply it by font height.
Re: What is the default line break size?
Oh, I got it. You can obtain your height as following:
That should do the trick.
Wasn't meant to doublepost, but current member group won't let me edit my posts (or even see them for that matter).
Code: Select all
local height = yourfont:getHeight * yourfont:getWrap ( textstring )
Wasn't meant to doublepost, but current member group won't let me edit my posts (or even see them for that matter).
Re: What is the default line break size?
Seems that I've found the answer. I just had to multiply the Font:getHeight by the number of lines. Thus 14*1=14, 14*2=28 etc. So, I guess, the margin of each of the line is 1px from each side.
Anyway, thats enough to make the text box borders depend on the text block size properly.
Thanks for the help!
Anyway, thats enough to make the text box borders depend on the text block size properly.
Thanks for the help!
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests