text positioning - device vs sim - screenshot included

This image explains the issue I’m having: http://tinypic.com/view.php?pic=3480bar&s=5

For some reason, the simulator shows text I’ve created in a slightly different position (about 10 pixels higher) than my device does

I’ve worked around this for a long time by just positioning it ‘too low’ in the simulator so that it looks OK. But it’s a bit maddening as this affects me on multiple text fields and it seems like device should always match simulator

This happens whether I use display.newRetinaText or display.newEmbossedText, and on both iPhone and iPad

When I create the text, I create it as empty and then later on populate it with text

No idea though, why it looks one way in simulator and another on device.

Any ideas would be much appreciated

My config.lua follows:
application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”,
imageSuffix =
{
["@2"] = 2
},
},
} [import]uid: 32462 topic_id: 24605 reply_id: 324605[/import]

What about when using display.newText on the newest daily builds? (What build are you currently using?) [import]uid: 52491 topic_id: 24605 reply_id: 99726[/import]

RUnning build 773 … I will try display.newText tonight and report back [import]uid: 32462 topic_id: 24605 reply_id: 99859[/import]

tried display.newText and I have the same issue.

here’s another screenshot that shows it in the xcode simulator vs the corona sim

http://tinypic.com/r/15ea9o5/5

if nobody else is running into this i’ll try to reduce to smallest code sample and submit a bug report, but I thought maybe this was a common issue [import]uid: 32462 topic_id: 24605 reply_id: 100436[/import]

I thought we may have had a bug similar/related to this but cannot seem to find it in fogbugz - if you were able to submit a bug with a zip the engineering team could run it would certainly be very useful for us. [import]uid: 52491 topic_id: 24605 reply_id: 100508[/import]

Hi Peach,
I submitted case #13924 through the “submit a bug” form at

http://developer.anscamobile.com/content/bug-submission

Should I also submit through fogbugz?

Thx

-Joe [import]uid: 32462 topic_id: 24605 reply_id: 103742[/import]

Hey Joe,

That goes to fogbuz automatically :slight_smile:

Thanks,
Peach [import]uid: 52491 topic_id: 24605 reply_id: 103818[/import]

I will look into this issue for you. [import]uid: 84637 topic_id: 24605 reply_id: 103892[/import]

It is already filed #12520 and I did that some months ago.

Joakim [import]uid: 81188 topic_id: 24605 reply_id: 103893[/import]

@jkrassman, I will look into your case also. Expect a reply tomorrow :slight_smile: [import]uid: 84637 topic_id: 24605 reply_id: 103895[/import]

Great @Danny - give you +1 for that answer :slight_smile:

Joakim

[import]uid: 81188 topic_id: 24605 reply_id: 103898[/import]

Uh, the fonts are different. Notice the #1 at the end has a base on one and not the other. Using different fonts can cause positioning errors.

[import]uid: 19626 topic_id: 24605 reply_id: 103929[/import]

I see what you’re saying but it’s the same code in both cases (using native.systemFont). Also, I attached very simple sample code to my bug report that include one case where it happens, and a commented out version where it doesn’t

Basically if I do

test= display.newText("",[...more params])  
test.text="Hello"  

the problem happens…if I do

test=display.newText("Hello",[...more params])  

it doesn’t happen [import]uid: 32462 topic_id: 24605 reply_id: 103939[/import]

@jflowers45: I have tested your case and it does appear to be a bug.

I emailed you a reply that explains a work around you can use for the time being, il post it here also as a reference:

[code]
–Workaround
local txt_identity=display.newText( “”, 235, 100, native.systemFont, 30 )
txt_identity.text=“Hello World”

–Reset text’s reference point
txt_identity:setReferencePoint(display.CenterReferencePoint)
–Reset text’s x position
txt_identity.x = 235
–Reset text’s y position and add to it the height of the text divided by two
txt_identity.y = 100 + txt_identity.height * 0.5
[/code] [import]uid: 84637 topic_id: 24605 reply_id: 103966[/import]

@jkrassman, I tested your case also, and you are correct, it appears slightly too high. That’s a slightly different bug than the OP’s bug so the workaround wont work.

Both bugs have been passed onto the engineering team.

Thanks! [import]uid: 84637 topic_id: 24605 reply_id: 103969[/import]

Awesome - thank you for confirming the bug and providing a workaround - always good to know I’m not imagining things :slight_smile: [import]uid: 32462 topic_id: 24605 reply_id: 104005[/import]

I put the workaround into a function … the trick is that when you record the old Y, you have to subtract the height/2 first. but this seems to solve it

[code]

updateText=function(theField,theVal)
local ofX=theField.x
local ofY=theField.y - theField.height/2
theField.text=theVal;
theField:setReferencePoint(display.CenterReferencePoint )
theField.x = ofX
theField.y = ofY + theField.height * 0.5
end

[/code] [import]uid: 32462 topic_id: 24605 reply_id: 105233[/import]

Just a reminder… fingers crossed this makes it into the round of bug fixes you guys are working on right now:) [import]uid: 32462 topic_id: 24605 reply_id: 109122[/import]

I’m using build 929 and this is still a problem.

Any idea on when this will get fixed? It’s very frustrating to align text this way.

-Mark [import]uid: 9189 topic_id: 24605 reply_id: 128029[/import]

This will not be fixed, we have to live with it - that was the answer I got from my bugreport.

Use a variable to align your text correctly according to the device positioning. It works fine.

Joakim [import]uid: 81188 topic_id: 24605 reply_id: 128030[/import]