@ansca: Why newRetinaText?

I must be missing something, but I can’t understand why there’s a distinction between regular text and hi-res “retina” text. IMHO text should always be displayed in the highest possible resolution on the device, and thus only one newText() function would be necessary.

What I’m using now to solve this issue is the following function, which is working well on all devices I’ve tested it on. It should also be future-proof whenever the iPad comes out with a high-res display as well.

[lua]Module.newText = function(str, xPos, yPos, font, size)
local scaleY = display.contentScaleY;
local scaleFactor = 1.0;

if (scaleY < 1.0) then
scaleFactor = 1 / scaleY;
end

local text = display.newText(str, 0, 0, font, size * scaleFactor);

text.xScale = scaleY;
text.yScale = scaleY;
text.x = xPos;
text.y = yPos;

return text;
end[/lua]
BTW: The current retina-text functions in Corona don’t display hi-res text on an iPad.
[import]uid: 70847 topic_id: 18314 reply_id: 318314[/import]

thanks for code, its definitely be helpful [import]uid: 16142 topic_id: 18314 reply_id: 70168[/import]

+1 Text should always render at its best on the device. [import]uid: 19626 topic_id: 18314 reply_id: 70174[/import]

+1… I can’t change how I set up my current project at this point, but it sure would be so helpful if text always render nice and crisp on various device without the need for manually coding/preparing for all possible outcome. [import]uid: 67217 topic_id: 18314 reply_id: 70177[/import]

@ingemar,

The function you’re using looks similar to the initial “workaround” retina text function that Jon Beebe wrote, which eventually got bundled into the Widget library, and now finds itself as a core API in the Corona library.

The issue with the original (and from various reports, with the latest incarnation in the API library) is that it might not handle reference point alignments properly. This isn’t an issue if all of your text uses center alignment, but my experiments with different reference points in Jon’s original workaround were frustrating to say the least. Does your function overcome this limitation? Or have you tried using different reference points?

By the way, +1000 on Ansca creating ONE solid, tested, future-proof text API. I don’t care if they depreciate “newText()” entirely and use “newRetinaText()” as the standard, but users should be given one reliable method that works on all current AND future devices.

Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 18314 reply_id: 82957[/import]

@IgnisDesign

I haven’t played around too much with different reference points, however I’ve always managed to get my text objects to behave the way I want to on high/low-res devices.
Sometimes it can be confusing though if you forget to re-set the object’s x and y properties after the reference-point change, especially if you’re grouping things together.

<rant: on>
My main gripe about having these 2 functions is that newRetinaText() doesn’t produce high-res text on the iPad even though with its resolution of 1024x768 it’s higher than a Retina display (960x640).
OK, the iPad doesn’t have a Retina display, but that’s besides the point. It still has a higher resolution and it should therefore be possible to create high-res text, which brings me to my next point: The function name, “Retina” is iOS specific. Corona is not. “Retina” should be dropped, and text should always be created at the device’s native resolution.

Having an API with 2 text functions is something that the developer shouldn’t have to care about. Text is text. Low-res or high-res doesn’t matter.

There should only be newText() to handle all our text needs.
<rant: off> [import]uid: 70847 topic_id: 18314 reply_id: 83052[/import] </rant:></rant:>

@ingemar

Yes, absolutely! You just echoed my exact opinion on this issue, which I elaborated on in a new thread in Feature Requests (I posted it soon after I responded to your original message). My testing has yielded the exact same results: noticeably blurry text on the iPad1&2 despite this device having a higher resolution than the iPhone4. As you’ll notice in my new posting, I acknowledge that the iPad doesn’t have a “Retina” display; in fact it’s somewhat sub-par despite the nice overall size, just slightly higher than the iPhone4 resolution but stretched out over 4x the physical size.

As you say, why are 2 functions necessary? Why, in fact, do we need “Retina” vs. “non-Retina”? What even determines “Retina” in the Corona vocabulary? “Retina” is an Apple term, but Corona should have a text API that simply obeys pixel resolution totally independent from device size.

I actually don’t even know how Corona currently determines the difference between the 2 functions. Tom (Ansca) hinted that on non-Retina devices, Corona internally calls the original “newText()” function when the developer uses “newRetinaText()”. Strange… does Corona simply look at the device “type” and determine which function to use, versus looking at the actual device resolution?

Anyway, if you want to comment on my new posting, please post a response. The more people who respond and request an update, the sooner we might get a solid, tested, reliable text API for all device resolution.

http://developer.anscamobile.com/forum/2012/01/27/future-newretinatext-ipad3

Brent Sorrentino
Ignis Design
[import]uid: 9747 topic_id: 18314 reply_id: 83063[/import]

For me, it seems newRetinaText works better if you first require “widgets” … weird tho, right? [import]uid: 10389 topic_id: 18314 reply_id: 83450[/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: 18314 reply_id: 94935[/import]