Different native font sizes on different iPad versions.

Hi - I am using native fonts for some incidental text in my app. However, the font size appears different on iPad “1” (okay) and iPad “3” (tiny).

In the Corona post “http://www.coronalabs.com/blog/2012/08/22/faq-wednesday-mac-simulator-and-native-fonts/”, it states that “Fonts used in display.newText are rendered as bit images and do scale correctly.”.

I use this in my app, which runs fine in the simulator, but not on the iPad “3” i.e. it does not scale! Any ideas?

I am using:
display_line1 = display.newText(line1,0,0,native.systemFont,10)
display_line1.x = display.contentWidth / 2
display_line1.y = display.contentHeight * 0.30
display_line1.size=30
display_line1:setTextColor(255,200,255)

Thanks in advance,
Dave. [import]uid: 82595 topic_id: 37380 reply_id: 67380[/import]

are you using the latest public build or a daily build? (that’s first thing they’ll ask) [import]uid: 32462 topic_id: 37380 reply_id: 145566[/import]

Good point :slight_smile: Corona 971, xcode 4.6, Mountain Lion. [import]uid: 82595 topic_id: 37380 reply_id: 145567[/import]

Native display objects fonts don’t scale like all the other Corona scaling does. If you’re on a retina iPad you will need to double the font size for native objects over a regular iPad or iPad mini. Likewise if you’re stating on a 3Gs at 320x480, those fonts will need to be bigger on the iPad or the retina phones.

You can use display.contentHeight and display.pixelHeight to compute a scale factor and multiple your font’s for native objects by that value:

local myFontSize = 16  
local scale = display.pixelHeight / display.contentHeight  
myTextField = native.newTextField(0,0,100,20)  
myTextField.size = myFontSize \* scale  

Or something like that to get you started.
[import]uid: 199310 topic_id: 37380 reply_id: 145596[/import]

Rob,
I *think* there may be some confusion here. He’s talking about using native.systemFont in a regular display object created with display.newText. Your example is creating an actual native displayObject which I thought followed a different set of rules (but I could be wrong)

hopefully I’m not confusing the issue even more :slight_smile: [import]uid: 32462 topic_id: 37380 reply_id: 145601[/import]

Naw your right, I missed the display.newText bit.

What does your config.lua look like?
[import]uid: 199310 topic_id: 37380 reply_id: 145603[/import]

Just as a quick test, can you take out the line where you specify .size as 30? I seem to recall that I had an issue with that recently (could be a bug), and I intended to follow up and investigate but it got buried under a dozen other priorities. :stuck_out_tongue:

In any case, I never use that command, I always set my font size in the main API call.

Brent [import]uid: 200026 topic_id: 37380 reply_id: 145628[/import]

are you using the latest public build or a daily build? (that’s first thing they’ll ask) [import]uid: 32462 topic_id: 37380 reply_id: 145566[/import]

Good point :slight_smile: Corona 971, xcode 4.6, Mountain Lion. [import]uid: 82595 topic_id: 37380 reply_id: 145567[/import]

Native display objects fonts don’t scale like all the other Corona scaling does. If you’re on a retina iPad you will need to double the font size for native objects over a regular iPad or iPad mini. Likewise if you’re stating on a 3Gs at 320x480, those fonts will need to be bigger on the iPad or the retina phones.

You can use display.contentHeight and display.pixelHeight to compute a scale factor and multiple your font’s for native objects by that value:

local myFontSize = 16  
local scale = display.pixelHeight / display.contentHeight  
myTextField = native.newTextField(0,0,100,20)  
myTextField.size = myFontSize \* scale  

Or something like that to get you started.
[import]uid: 199310 topic_id: 37380 reply_id: 145596[/import]

Rob,
I *think* there may be some confusion here. He’s talking about using native.systemFont in a regular display object created with display.newText. Your example is creating an actual native displayObject which I thought followed a different set of rules (but I could be wrong)

hopefully I’m not confusing the issue even more :slight_smile: [import]uid: 32462 topic_id: 37380 reply_id: 145601[/import]

Naw your right, I missed the display.newText bit.

What does your config.lua look like?
[import]uid: 199310 topic_id: 37380 reply_id: 145603[/import]

Just as a quick test, can you take out the line where you specify .size as 30? I seem to recall that I had an issue with that recently (could be a bug), and I intended to follow up and investigate but it got buried under a dozen other priorities. :stuck_out_tongue:

In any case, I never use that command, I always set my font size in the main API call.

Brent [import]uid: 200026 topic_id: 37380 reply_id: 145628[/import]