Win32 OS font scaling

I have noticed a problem that I am not sure how I am to deal with it. I have not noticed this with other games on Windows so I suspect it is the default way Corona is using the OS to create text objects.

When the font scale settings in Windows are scaled up, it causes text scaling in Corona Win32 apps. It can be seen within the simulator too. If someone has their font’s scaled to 150%, then the text can end up partially under other elements or be partially offscreen without me being able to detect and adjust for it.

So my question: Is there a way to work around this in Desktop builds without converting 100% to bitmap fonts? Is it possible for the Corona team to change text object creation to some how default the 100% scaling for just the Corona app?

Can you show us a screen shot of the Win32 app and the same app in the Simulator as well as post the code were you’re creating the text?

Thanks

Rob

I noticed this mainly with blocks of text. Single lines of text I don’t notice because they are always centered where they need to be. With blocks of text the block gets longer and longer with each newline, thus appearing where it does not belong the larger the block becomes.

Here is the code:

-- OPTIONS SETUP local op = { text = "", width = 202, height = 100, font = myFont, fontSize = 16, align = "center" } local op2 = { text = "", width = 188, height = 300, font = myFont, fontSize = 14, align = "left" } -- SETTING UP NEWTEXT st[22] = display.newText(op) st[22].x = dcx2 - 109 st[22].y = dcy2 - 20 st[23] = display.newText(op2) st[23].x = dcx2 - 108 st[23].y = dcy2 + 128 st[23]:setFillColor(225/255,225/255,225/255) st[24] = display.newText(op2) st[24].x = dcx2 - 108 st[24].y = dcy2 + 128 st[24]:setFillColor(255/255,255/255,0/255) -- POPULATE POPUP TEXT local pc = {} local pt = {} pc[1] = 0 pc[2] = 0 pc[3] = 0 pc[4] = 0 pc[5] = 0 pc[6] = 0 pt[1] = "Base Rating:\n" pt[2] = "Base Rating: 10\n" if i == 1 then st[22]:setFillColor(gradT2) st[22].text = "Earth Gem\nPower Rating" elseif i == 2 then st[22]:setFillColor(gradT8) st[22].text = "Air Gem\nPower Rating" elseif i == 3 then st[22]:setFillColor(gradT3) st[22].text = "Ice Gem\nPower Rating" elseif i == 4 then st[22]:setFillColor(gradT6) st[22].text = "Fire Gem\nPower Rating" elseif i == 5 then st[22]:setFillColor(gradT4) st[22].text = " Shadow Gem\nPower Rating" elseif i == 6 then st[22]:setFillColor(gradT7) st[22].text = "Light Gem\nPower Rating" end for slot = 1, 7 do if saveData[cpro].items[slot] ~= nil then local pls = saveData[cpro].items[slot].elt local has = saveData[cpro].items[slot].abt local plus = 0 for c = 1, 6 do if pls[c] == i then plus = has[c] break end end local v1 = string.find(saveData[cpro].items[slot].name," ") local v2 = saveData[cpro].items[slot].name:sub(0,v1) if plus \> 0 then pt[1] = pt[1] .. v2 .. ": " pt[2] = pt[2] .. v2 .. ": +" .. plus pc[1] = pc[1] + plus else pt[1] = pt[1] .. v2 .. ": -" pt[2] = pt[2] .. v2 .. ": -" end else local v2 = "" if slot == 1 then v2 = "Cloak" elseif slot == 2 then v2 = "Jewelry" elseif slot == 3 then v2 = "Bracers" elseif slot == 4 then v2 = "Belt" elseif slot == 5 then v2 = "Gloves" elseif slot == 6 then v2 = "Boots" elseif slot == 7 then v2 = "Trinket" end pt[1] = pt[1] .. v2 .. ": -" pt[2] = pt[2] .. v2 .. ": -" end pt[1] = pt[1] .. "\n" pt[2] = pt[2] .. "\n" end pt[1] = pt[1] .. "Spell Modifier: \n" pt[2] = pt[2] .. "Spell Modifier: " .. spellmod[i] .. "\n" pt[1] = pt[1] .. "Final Rating: \n" pt[2] = pt[2] .. "Final Rating: " .. (pc[1]+10)\*spellmod[i] .. "\n" st[23].text = pt[1] st[24].text = pt[2]

Screenshot is attached. The text in the popup near the bottom left fits normally and looks correct on a desktop with 100% default scaling. This screenshot is the desktop build on a system using 150% desktop scaling. It also looks identical in the simulator with 150% scaling (using .2830 and .2906).

I’m not sure what you mean by 150% scaling. How are you scaling it? Zooming the window some how? In code with the :scale() method?

Sorry for not being more clear.

The font scaling is in the display settings of Windows. Higher resolutions make the text smaller and smaller so some people scale the font up in Windows (from 100% to 125% or 150%) to make it easier on the eyes. This scaling carries over into text objects in Corona apps and simulator. I don’t recall any games I have played that are affected by the OS Font settings like this. So I am assuming this is a problem with how Corona uses the OS to rasterize the text. 

Can you show us a screen shot of the Win32 app and the same app in the Simulator as well as post the code were you’re creating the text?

Thanks

Rob

I noticed this mainly with blocks of text. Single lines of text I don’t notice because they are always centered where they need to be. With blocks of text the block gets longer and longer with each newline, thus appearing where it does not belong the larger the block becomes.

Here is the code:

-- OPTIONS SETUP local op = { text = "", width = 202, height = 100, font = myFont, fontSize = 16, align = "center" } local op2 = { text = "", width = 188, height = 300, font = myFont, fontSize = 14, align = "left" } -- SETTING UP NEWTEXT st[22] = display.newText(op) st[22].x = dcx2 - 109 st[22].y = dcy2 - 20 st[23] = display.newText(op2) st[23].x = dcx2 - 108 st[23].y = dcy2 + 128 st[23]:setFillColor(225/255,225/255,225/255) st[24] = display.newText(op2) st[24].x = dcx2 - 108 st[24].y = dcy2 + 128 st[24]:setFillColor(255/255,255/255,0/255) -- POPULATE POPUP TEXT local pc = {} local pt = {} pc[1] = 0 pc[2] = 0 pc[3] = 0 pc[4] = 0 pc[5] = 0 pc[6] = 0 pt[1] = "Base Rating:\n" pt[2] = "Base Rating: 10\n" if i == 1 then st[22]:setFillColor(gradT2) st[22].text = "Earth Gem\nPower Rating" elseif i == 2 then st[22]:setFillColor(gradT8) st[22].text = "Air Gem\nPower Rating" elseif i == 3 then st[22]:setFillColor(gradT3) st[22].text = "Ice Gem\nPower Rating" elseif i == 4 then st[22]:setFillColor(gradT6) st[22].text = "Fire Gem\nPower Rating" elseif i == 5 then st[22]:setFillColor(gradT4) st[22].text = " Shadow Gem\nPower Rating" elseif i == 6 then st[22]:setFillColor(gradT7) st[22].text = "Light Gem\nPower Rating" end for slot = 1, 7 do if saveData[cpro].items[slot] ~= nil then local pls = saveData[cpro].items[slot].elt local has = saveData[cpro].items[slot].abt local plus = 0 for c = 1, 6 do if pls[c] == i then plus = has[c] break end end local v1 = string.find(saveData[cpro].items[slot].name," ") local v2 = saveData[cpro].items[slot].name:sub(0,v1) if plus \> 0 then pt[1] = pt[1] .. v2 .. ": " pt[2] = pt[2] .. v2 .. ": +" .. plus pc[1] = pc[1] + plus else pt[1] = pt[1] .. v2 .. ": -" pt[2] = pt[2] .. v2 .. ": -" end else local v2 = "" if slot == 1 then v2 = "Cloak" elseif slot == 2 then v2 = "Jewelry" elseif slot == 3 then v2 = "Bracers" elseif slot == 4 then v2 = "Belt" elseif slot == 5 then v2 = "Gloves" elseif slot == 6 then v2 = "Boots" elseif slot == 7 then v2 = "Trinket" end pt[1] = pt[1] .. v2 .. ": -" pt[2] = pt[2] .. v2 .. ": -" end pt[1] = pt[1] .. "\n" pt[2] = pt[2] .. "\n" end pt[1] = pt[1] .. "Spell Modifier: \n" pt[2] = pt[2] .. "Spell Modifier: " .. spellmod[i] .. "\n" pt[1] = pt[1] .. "Final Rating: \n" pt[2] = pt[2] .. "Final Rating: " .. (pc[1]+10)\*spellmod[i] .. "\n" st[23].text = pt[1] st[24].text = pt[2]

Screenshot is attached. The text in the popup near the bottom left fits normally and looks correct on a desktop with 100% default scaling. This screenshot is the desktop build on a system using 150% desktop scaling. It also looks identical in the simulator with 150% scaling (using .2830 and .2906).

I’m not sure what you mean by 150% scaling. How are you scaling it? Zooming the window some how? In code with the :scale() method?

Sorry for not being more clear.

The font scaling is in the display settings of Windows. Higher resolutions make the text smaller and smaller so some people scale the font up in Windows (from 100% to 125% or 150%) to make it easier on the eyes. This scaling carries over into text objects in Corona apps and simulator. I don’t recall any games I have played that are affected by the OS Font settings like this. So I am assuming this is a problem with how Corona uses the OS to rasterize the text.