Difference in Y position for texts in Simulator and real device

Hi guys,

When I display text with native.systemFont and size of 10, on a real device (4S) text appears shifted up on Y axis compared to the simulator (Mac, 3GS).

Is it something you may fix, or it is too hard and I should rely on real device for testing?

Cheers!

I have found that it happens when Simulator is configured for iPhone 3GS and I test on iPhone 4.

When Simulator is set for iPhone4, everything is the same both on device and in Simulator.

I set Y position using display.contentHeight*<some value like 0.25>. It has worked for other UI elements, but apparently doesn’t work for texts.

Any clue how to make it work across 3GS and 4? Adding if statements and checking for the device to calculate correct offset is very ugly.

I haven’t noticed a difference between devices, but I am struggling with a specific font that’s about 3 pixels different from simulator to device. It’s hard to get things just right when, in your development, it has to look wrong to be correct on the device.

I ended up using a global variable and this little chunk of code in main.lua:

[lua]

if system.getInfo(“environment”) == “simulator” then simulator = true end

simYFudge = 3

if simulator then

    simYFudge = 0

end

[/lua]

Then whenever I set the Y value for the text I always add that fudge factor:

[lua]

myMessage.y = 20 + simYFudge

[/lua]

For me that turned out to be the fastest/easiest solution.

 Jay

I have found that it happens when Simulator is configured for iPhone 3GS and I test on iPhone 4.

When Simulator is set for iPhone4, everything is the same both on device and in Simulator.

I set Y position using display.contentHeight*<some value like 0.25>. It has worked for other UI elements, but apparently doesn’t work for texts.

Any clue how to make it work across 3GS and 4? Adding if statements and checking for the device to calculate correct offset is very ugly.

I haven’t noticed a difference between devices, but I am struggling with a specific font that’s about 3 pixels different from simulator to device. It’s hard to get things just right when, in your development, it has to look wrong to be correct on the device.

I ended up using a global variable and this little chunk of code in main.lua:

[lua]

if system.getInfo(“environment”) == “simulator” then simulator = true end

simYFudge = 3

if simulator then

    simYFudge = 0

end

[/lua]

Then whenever I set the Y value for the text I always add that fudge factor:

[lua]

myMessage.y = 20 + simYFudge

[/lua]

For me that turned out to be the fastest/easiest solution.

 Jay