Issue aligning retina font on iphone 4s

Hey there guys,

so i have my score set up like this

local score = 0

local scoreText = display.newRetinaText( addThousandsSeparators(score), 25, 25, “GrilledCheese BTN Toasted”, 44)
scoreText:setReferencePoint(display.CenterLeftReferencePoint)
scoreText.x = 98
scoreText.y = 28
scoreText.alpha = 0.4
scoreText:setTextColor(1,1,1)
localGroup:insert( scoreText )

it sits right where i want it. In the SIM it works perfect when i change score it keeps its alignment
however on the iPhone 4s as son as i change score it moves over to the right.

when i update the score i do this

local function updateStats()
scoreText.text = addThousandsSeparators(score)
scoreText:setReferencePoint(display.CenterLeftReferencePoint)
scoreText.x = 98
end

anyone have an idea on why this happens?

cheers

[import]uid: 8094 topic_id: 23829 reply_id: 323829[/import]

anyone have any idea on this issue?
its driving me crazy :slight_smile:

[import]uid: 8094 topic_id: 23829 reply_id: 96005[/import]

I had the very same problem but I just decided to not use Retina Text. :confused:

I am curious as to how to fix this. [import]uid: 103624 topic_id: 23829 reply_id: 96006[/import]

Text can be finicky. I wrap text objects in a little class that keeps track of how objects were instantiated so I can just do textObject:setText(“new”) and it’ll reset the text position for me.

This is my simple solution you could try, there are certainly others as well worth checking out in the code base:
http://developer.anscamobile.com/code/dynamic-resolution-retina-text-class

Then your code above would look something roughly like this:

[code]
local txt = require “txt”
local score = 0

local scoreText = txt.new(addThousandsSeparators(score), 98, 28, “GrilledCheese BTN Toasted”, 44, display.CenterLeftReferencePoint)
scoreText.alpha = 0.4
scoreText:setTextColor(1,1,1)
localGroup:insert( scoreText )

local function updateStats()
scoreText:setText( addThousandsSeparators(score) )
end[/code]
And that should do it :slight_smile: Abstracting the repositioning code is handy because otherwise you have to keep track of the origin and reference points of each text object on your own.

Note that txt was designed before ansca deprecated RetinaText in the very latest daily builds. I personally don’t use those builds yet due to some ongoing storyboard issues being worked out, but you could easily update it to use newText if you are.

Honestly your code looks like it should be working just fine but you never know with text objects… [import]uid: 87138 topic_id: 23829 reply_id: 96008[/import]

I just wanted to point out here that as of build 771 you no longer need to use newRetinaText.

See notes here: http://developer.anscamobile.com/release/2012/771

Peach :slight_smile: [import]uid: 52491 topic_id: 23829 reply_id: 96030[/import]