Hi all,
I’m trying to figure out how to set the font size for textfields for different devices.
For instance:
local tHeight = 20
if isAndroid then tHeight = 40 end -- adjust for Android
nameTxt = native.newTextField( 15, 80, 150, tHeight, nameTxtHandler )
nameTxt.font = native.newFont( native.systemFontBold, 36 )
nameTxt:setReferencePoint(display.c)
nameTxt.isVisible = true
nameTxt.x = background.x - 10
nameTxt.y = background.y
localGroup:insert(nameTxt)
nameTxt.text = myPlayer.name
Will show the textfield with bold font on the ipad in proportion to the textbox. On the ipod (Xcode simulator) the font is huge.
Is there a way to set the font automatically according to the screen size or do I have to manually check the display.contentScaleX for the scaling factor and then set the font accordingly?
Thanks.
Nathan. [import]uid: 23864 topic_id: 16716 reply_id: 316716[/import]