Set the line height on newText

Hi.

I need to set the line height/spacing in a text created with newText and, unexpectedly, I haven’t seen any way to adjust it.

Is there any way to do that or Text candy will be my last chance?

Thanks!

Not sure what you want to do here, also I assume you mean:  display.newText()

If that is the function you’re talking about, you can only specify font size upon creation.  However, if you don’t mind making the font look squished, you can always change the scale after you create the object.

local myText = display.newText( "Hello World!", 100, 200, native.systemFont, 16 ) myText:setFillColor( 0, 0.5, 1 ) myText:scale( 1, 0.75 ) -- Make 1/4 shorter

** FUTURE READERS ** Looks like Text Candy Is Up-To-Date so, if you’re so inclined, I’d get it.  It is a beautiful and feature-full library.  I’ve had the opportunity to see if first-hand while working with clients who owned a license 

Oh, and Text Candy may not be supported any more.  It’s a beautiful looking library, but I’m not sure the author is keeping it up to date with Graphics 2.0.  I’d check on that first.  ( If it is up-to-date, then yeah go for it ).

Note: I used the legacy syntax above.  You may want to go with the modern version instead.  Take a look at the docs, they’ll explain the difference.

Well, what I’d like to do is specify the gap between lines. Currently a multiline text looks not as good as it should, because the lines are very stuck together.

I’m not sure if Text Candy is up to date, I’ll try to find it out!

Edit: I found that “All Candy libraries, Particle Candy, as well as Widget Candy and Text Candy, have been updated to be Graphics 2.0 compliant”. That’s good, but It’s a shame I need to spend money just for a basic “line spacing” property.

Come now.  Be fair.  I think the $0 cost for Corona and all its wonderful features outweighs having to solve line spacing on your own or having to get a library. 

:wink:

On a side note, if you’ve got a lot of text, you are probably better off using Text Candy or another library that uses bitmapped fonts because text rendering is pretty costly in terms of computing and memory, whereas image rendering (which is what bitmapping takes advantage of) is optimized.  (This is my opinion, based on some experimentation and measurement.)

PS - Thanks for checking on Text Candy.  (I amended my comment above for future readers.)

That’s why I don’t like making closed budgets, it’s pretty hard to know every aspect of the project!

Anyway, I’m happy to pay if it does what I need.

Thanks for your time roaminggamer :slight_smile:

Edit: Oh no! “Due to restrictions of the LUA string library shipped with the Corona SDK, Text Candy does not support multibyte characters (f.e. accented chars) yet.”. I need to manage some translations and one of them is spanish (with accented chars) :frowning:

Not sure what you want to do here, also I assume you mean:  display.newText()

If that is the function you’re talking about, you can only specify font size upon creation.  However, if you don’t mind making the font look squished, you can always change the scale after you create the object.

local myText = display.newText( "Hello World!", 100, 200, native.systemFont, 16 ) myText:setFillColor( 0, 0.5, 1 ) myText:scale( 1, 0.75 ) -- Make 1/4 shorter

** FUTURE READERS ** Looks like Text Candy Is Up-To-Date so, if you’re so inclined, I’d get it.  It is a beautiful and feature-full library.  I’ve had the opportunity to see if first-hand while working with clients who owned a license 

Oh, and Text Candy may not be supported any more.  It’s a beautiful looking library, but I’m not sure the author is keeping it up to date with Graphics 2.0.  I’d check on that first.  ( If it is up-to-date, then yeah go for it ).

Note: I used the legacy syntax above.  You may want to go with the modern version instead.  Take a look at the docs, they’ll explain the difference.

Well, what I’d like to do is specify the gap between lines. Currently a multiline text looks not as good as it should, because the lines are very stuck together.

I’m not sure if Text Candy is up to date, I’ll try to find it out!

Edit: I found that “All Candy libraries, Particle Candy, as well as Widget Candy and Text Candy, have been updated to be Graphics 2.0 compliant”. That’s good, but It’s a shame I need to spend money just for a basic “line spacing” property.

Come now.  Be fair.  I think the $0 cost for Corona and all its wonderful features outweighs having to solve line spacing on your own or having to get a library. 

:wink:

On a side note, if you’ve got a lot of text, you are probably better off using Text Candy or another library that uses bitmapped fonts because text rendering is pretty costly in terms of computing and memory, whereas image rendering (which is what bitmapping takes advantage of) is optimized.  (This is my opinion, based on some experimentation and measurement.)

PS - Thanks for checking on Text Candy.  (I amended my comment above for future readers.)

That’s why I don’t like making closed budgets, it’s pretty hard to know every aspect of the project!

Anyway, I’m happy to pay if it does what I need.

Thanks for your time roaminggamer :slight_smile:

Edit: Oh no! “Due to restrictions of the LUA string library shipped with the Corona SDK, Text Candy does not support multibyte characters (f.e. accented chars) yet.”. I need to manage some translations and one of them is spanish (with accented chars) :frowning: