This might concern many developers who have been wrestling for some time with the “Retina text” issue (blurry text on Retina devices unless you implement Jon Beebe’s scaling functions or similar). I think I have discovered a method to get razor-sharp text without doing any of that, and without creating more image assets or otherwise.
It comes down to the “config.lua” file. Compare the following:
Ansca’s example code for dynamic image scaling:
application =
{
content =
{
width = 320,
height = 480,
scale = "letterbox",
imageSuffix =
{
["@2"] = 2,
["@3"] = 3,
["-bar"] = 3.3,
["-foo"] = 4.5,
},
},
}
My current code within config.lua:
application =
{
content =
{
width = 800,
height = 1200,
scale = "letterbox",
imageSuffix =
{
["\_1"] = 0.4,
["\_2"] = 0.6
["\_3"] = 0.85
}
}
}
The difference is simple: Ansca’s method sets a LOW base resolution (320x480) and then scales UP for the dynamic scaling settings. My code uses a HIGH base resolution (800x1200) and then scales DOWN, using percentages in decimal form.
The end result is the same in regards to image assets (you won’t need to remake all of your art assets if you simply recalculate the scaling factors properly). But this might make a big difference for text! In my code, the text resolution begins high, and then gets scaled down by Corona, which is exactly what Jon’s functions do (specify double-size text in the newText function, then scale it down to 0.5).
Further testing is necessary to determine if this truly works on all devices. For now, I can attest that I haven’t used any “tweaks” or functions atop the base newText function. And my text on a Retina device is brilliantly sharp, in every instance.
Can others please test this out in their code and on their devices? Knock on wood, perhaps this is the most simple solution yet… and if it does work, it spares us having to include add-on functions or “rewrite” the newText function; not to mention those add-on functions caused me endless frustration when I tried to align text using reference points other than top-left or whatever the default is.
Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 15670 reply_id: 315670[/import]
If you’ve created “Retina” images already, you can still use them… all that’s necessary is tweaking the config file numbers and scaling appropriately. [import]uid: 9747 topic_id: 15670 reply_id: 57836[/import]