display.newText height discrepencies

I’ve just started noticing large differences between the height of multi-line text objects on the simulator to the device. 

The devices seem to render correctly, while the simulator adds an extra invisible line. Has anyone else noticed this? Perhaps it’s something specific to the font I’m using on my setup, so I just wanted to check before I spend time digging into it.

Corona SDK depends on the OS’s native font rendering.  There will always be some difference between the two.

Rob

That true, though I’ve never noticed it being this severe! Is there any idea of what the margins of error between the platforms are?

Urrgh! Turns out the issue came down to the fact that I used multiline quotes! 

For example:

[lua]

local dumb=[[

  All the white space

gets rendered, even the new lines at the end

]] – <-- here

[/lua]

I don’t usually use multiline quotes when rendering text, and perhaps it might be best to avoid them completely!

Actually this is exactly how multi-line quotes are supposed to work.  Let me put in \n’s for the end of line markers that you have in your code:

\n

  All the white space\n

gets rendered, even the new lines at the end\n

\n

 

By putting the [[and]] on separate lines, you have in fact added blank lines at the top and bottom.

 

Rob

Thanks, that makes sense. It’s one of the language features that consistently catches me out. 

Corona SDK depends on the OS’s native font rendering.  There will always be some difference between the two.

Rob

That true, though I’ve never noticed it being this severe! Is there any idea of what the margins of error between the platforms are?

Urrgh! Turns out the issue came down to the fact that I used multiline quotes! 

For example:

[lua]

local dumb=[[

  All the white space

gets rendered, even the new lines at the end

]] – <-- here

[/lua]

I don’t usually use multiline quotes when rendering text, and perhaps it might be best to avoid them completely!

Actually this is exactly how multi-line quotes are supposed to work.  Let me put in \n’s for the end of line markers that you have in your code:

\n

  All the white space\n

gets rendered, even the new lines at the end\n

\n

 

By putting the [[and]] on separate lines, you have in fact added blank lines at the top and bottom.

 

Rob

Thanks, that makes sense. It’s one of the language features that consistently catches me out.