multiline text skewed in different simulator skins

I’m using multiline text with display.newText by specifying and width and height, and while everything looks good at the native resolution for my app (iphone4), when I switch to the iphone or ipad skin the text is skewed.

Here are some examples of the text in the iphone skin:
http://screencast.com/t/n0hWKQvrUG
http://screencast.com/t/MAbPBLQxwLsm

I’m using build 833 and also checked build 868. Does anyone have a workaround? I haven’t found any posts relating to this issue which is kind of shocking since this multiline feature came out in build 638! [import]uid: 27183 topic_id: 29433 reply_id: 329433[/import]

Hmm… I’ve never seen that happen before. And I’ve noticed that you have other multiline text in your app that are being rendered just fine.

Are you calling any functions and setting any properties on that one multiline text object? Are you making changes to its “width” and “height” properties?
Any other clues that you can provide us would be a great help. [import]uid: 32256 topic_id: 29433 reply_id: 118219[/import]

Here is the contents of my “main.lua” that I normally test multiline text with. This code expects that your “config.lua” file is missing or empty. That is, this code was not designed for dynamic content scaling and tests out taking advantage of the full screen resoltuion.

[lua]local background = display.newRect(0, 0, display.contentWidth, display.contentHeight)
background:setFillColor(128, 0, 0)

local gettysburgAddress = [[Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation, or any nation, so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.

But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us-that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion-that we here highly resolve that these dead shall not have died in vain-that this nation, under God, shall have a new birth of freedom-and that government of the people, by the people, for the people, shall not perish from the earth.]]

local message = gettysburgAddress
local textWidth = display.contentWidth - 50
local textHeight = display.contentHeight - 50
local fontSize = 18

local textField = display.newText(message, 25, 25, textWidth, textHeight, “Helvetica”, fontSize )
textField:setTextColor( 255, 255, 255 )[/lua]
[import]uid: 32256 topic_id: 29433 reply_id: 118221[/import]

Hi Josh,

I found out a bit more. It seems like it has something to do with the size passed into the width and height parameters of display.newText and how the dynamic scaling is applied to it to adjust.

For the first screenshot when viewed in the iphone4 skin, that upper right text has a width and height of 353, 126 and a warning comes up saying it bumped it up to 356, 128.

When it’s viewed on in iphone skin, that 353,126 it looks like the numbers are divided by two to match the resolution, but the weird part is that the 353 does not generate a warning in the terminal:

= > atrace (00:00:04:777) support_fpo 353 126
…n/Desktop/prog/corona/projects/cc_build/mod_game.lua:806: in function ‘get’

WARNING: Due to system limitations, display.newText() height is going to be increased to nearest multiple of 4: 63 ===> 64.

So it looks like that 353 should divide by 2 to give 176.5 and then be rounded up to 180, but that doesn’t happen.

When I change the 353, 126 to 356, 128 and then view it in the iphone skin everything looks fine. But now another field is broken on the ipad.

http://screencast.com/t/hZWn9h6W looks good on iphone now
http://screencast.com/t/DvUuExSNvY ipad is broken now

Here’s the warning for that skewed field on the ipad:

= > atrace (00:00:04:606) david_don_fpo 308 88
…n/Desktop/prog/corona/projects/cc_build/mod_game.lua:806: in function ‘get’

WARNING: Due to system limitations, display.newText() height is going to be increased to nearest multiple of 4: 93 ===> 96.

It looks like the width field is not being updated. The width should be scaled and rounded like so: 308 * 1.066666 -> 328.5333 rounded to nearest four = 332.

I hope this helps. [import]uid: 27183 topic_id: 29433 reply_id: 118230[/import]

Don,

Thanks for the details. Would you mind sending us a small zipped up project that can reproduce this issue via a bug report please? You can do so by clicking the “Report a Bug” link at the top of this web page. I’ll let the rest of the team know about this on Monday. Thanks! [import]uid: 32256 topic_id: 29433 reply_id: 118261[/import]

Hi Josh,

Sure thing! [import]uid: 27183 topic_id: 29433 reply_id: 118262[/import]

Did anything ever get resolved on this? I am essentially encountering the same issue. [import]uid: 135394 topic_id: 29433 reply_id: 138069[/import]

We haven’t done anything about it yet.

But you should be able to work-around this issue by setting the width of the text object to a multiple of 4 in pixels, not content coordinates if you are using our dynamic content scaling feature (ie: letterbox, zoomEven, zoomStretch). Corona’s [lua]display.contentScaleX[/lua] property provides you a scaler that you can use to convert from pixels to content coordinates and vice-versa. [import]uid: 32256 topic_id: 29433 reply_id: 138132[/import]

Did anything ever get resolved on this? I am essentially encountering the same issue. [import]uid: 135394 topic_id: 29433 reply_id: 138069[/import]

We haven’t done anything about it yet.

But you should be able to work-around this issue by setting the width of the text object to a multiple of 4 in pixels, not content coordinates if you are using our dynamic content scaling feature (ie: letterbox, zoomEven, zoomStretch). Corona’s [lua]display.contentScaleX[/lua] property provides you a scaler that you can use to convert from pixels to content coordinates and vice-versa. [import]uid: 32256 topic_id: 29433 reply_id: 138132[/import]