Benefits of newRetinaText?

I’m not using newRetinaText() because of it’s limitations on iPad 1/2.

I’ve written my own function instead where I use Corona’s newText() function and scale the text-size according to the device it’s running on. This gives me one function that produces sharp text on any device, retina-display or not, and it’s working perfectly for the new iPad.

Now I’m just wondering:
Are there any benefits of using Corona’s newRetinaText() as opposed to using my own function that scales the text?
[import]uid: 70847 topic_id: 23607 reply_id: 323607[/import]

newRetinaText has been updated (build ~730 I believe) and it seems to be working fine on all devices for me. They might be able to optimize it a bit better, but as long as you’re taking care of all the right cases (scaling the width and height as well as font sizes and so on), I don’t really think it should make a difference if you roll your own.

FWIW I use my own text class as well that wraps standard and embossed text, and I recently switched it over to use newRetinaText instead of my own custom scaling. It seems to work great now. A user was kind enough to let me know that it seemed to be working properly for them on the new iPad as well. [import]uid: 87138 topic_id: 23607 reply_id: 94669[/import]

Thanks @revaerie, I just did a quick check with build 767 and it does seem like newRetinaText() produces sharp text on all devices now… good.

Now another question comes to mind: Why have 2 text functions in the API, newText() and newRetinaText()?
[import]uid: 70847 topic_id: 23607 reply_id: 94715[/import]

Probably for the same reason you have display.newImage and display.newImageRect, backward compatibility.

By the way, as far as I know, newRetinaText is nothing more than a wrapper for newText that takes care of scalling.

The implementation should be nothing more than:

display.newRetinaText = function(string,left,top,font,size)  
 local text = display.newText(string,left,top,font,size/display.contentScaleX)  
 text.xScale = display.contentScaleX  
 text.yScale = display.contentScaleY  
  
 return text  
end  

This is the reason why (at least when it was first implemented) you were unable to mess with size and scale of retina text dynamicaly. [import]uid: 61899 topic_id: 23607 reply_id: 94802[/import]

This is good to know. Thanks for bringing this up and sharing your thoughts. I’m too close to submitting my game to make any drastic changes, but when I port my game to android, it sounds like I should start converting all retina text to newRetinaText that comes with Corona.

Cheers,
Naomi [import]uid: 67217 topic_id: 23607 reply_id: 94829[/import]

@ CluelessIdeas,

IMHO, I don’t see the correlation between the two text APIs and the two “image” APIs. "newImage()" and "newImageRect()" serve very specific purposes (choosing differently scaled image files or not), while the two text APIs cause more confusion than clarity.

As you say, I think the “retina” text API just wraps the original API up in an auto-scaling package… which is certainly useful for some developers, but I sincerely await the day when we have ONE text API that is fast, scales properly across all devices, and doesn’t contain any noticeable alignment issues. I don’t think either of the current text APIs can make these claims.
[import]uid: 9747 topic_id: 23607 reply_id: 94832[/import]

It might have not been the best example. I was referring mainly to the fact that newImageRect is used when scaling of the content is a factor, like using newRetinaText.

And I really second that wish that we have a text API that works well accross all devices, and mainly that alignment/rotation/placing issues, line breaking ability, and whatever else are all fixed. The text API as it is today is a shame to what Corona is as an SDK. [import]uid: 61899 topic_id: 23607 reply_id: 94833[/import]

That code sample is pretty darn interesting, CluelessIdeas, so thanks for that. I wanted to start using newEmbossedText but presumably it’s based on newText and not newRetinaText, so I guess I need to find some way to wrap it similarly… [import]uid: 41884 topic_id: 23607 reply_id: 94887[/import]

Regarding retina text:

display.newText() has been modified to handle “retina text” automatically, and therefore display.newRetinaText() has been deprecated since it is no longer needed.

The changes will be reflected in the next daily build (the one posted *after* 2012.770).
[import]uid: 52430 topic_id: 23607 reply_id: 94922[/import]

Jonathan, has EmbossedText also been updated? [import]uid: 41884 topic_id: 23607 reply_id: 94929[/import]

display.newEmbossedText() has been modified to use display.newText() rather than display.newRetinaText(), and unlike display.newRetinaText(), embossed text has *not* been deprecated. [import]uid: 52430 topic_id: 23607 reply_id: 94941[/import]

Hallelujah! A unified text API… Thanks @ansca!
The answer is not 42, it’s 771 :slight_smile: [import]uid: 70847 topic_id: 23607 reply_id: 94998[/import]

I’ve been waiting for this one…

Jonathon, the newRetinaText always seemed to be sitting lower in the simulator than when viewed on the device. I would have to increase my y value by about 2 to get it where I actually wanted it.

Is this fixed now? [import]uid: 22392 topic_id: 23607 reply_id: 95022[/import]

Yet another reason why I keep sticking to Corona, they really do listen to the issues and work hard to provide us with solid tools (even during a storm). Can’t wait to see the text issues get cleaned up! [import]uid: 21331 topic_id: 23607 reply_id: 95026[/import]