Font scaling problem

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
GloamingCat
Prole
Posts: 7
Joined: Wed Mar 01, 2017 8:37 pm

Font scaling problem

Post by GloamingCat »

Hello,

I'm struggling with rendering fonts when I have multiple screen sizes (scaling x and y independently) and a fixed font size. For some reason, if I first render the font in a canvas and then resize the canvas to a bigger one using "nearest" filter, the final image looks lighter and sharper than if I printed the text already scaled. Here's the comparison:

1) Print text (love.graphics.printf) in an auxiliar canvas with scale = 1, then draw the canvas (love.graphics.draw) in the screen using scale = 2. Result: http://prnt.sc/eeu7d6
2) Print text directly in the screen (love.graphics.printf) with scale = 2. Result: http://prnt.sc/eeu4cj

Currently I'm using the first case as a workaround, but it only looks good for more pixelated fonts. With some fonts, like Arial, it looks horrible. Compare:

1) Result: http://prnt.sc/eeu8ug
2) Result: http://prnt.sc/eeu9gn

Although both cases look bad, I believe the second case would look better if it wasn't darker. Does anyone know why does it look darker or what can I do to correct it? Have anyone had the same problem? Suggestions?

Thank you!
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Font scaling problem

Post by Positive07 »

This looks like you want the pre-multiplied BlendMode which is what you should use when drawing a Canvas. Or check the other Blend Modes until you find one that suits your needs
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
GloamingCat
Prole
Posts: 7
Joined: Wed Mar 01, 2017 8:37 pm

Re: Font scaling problem

Post by GloamingCat »

It really made lighter, thank you! The font still looks a bit blurred, though. But I think now the problem is in the font rendering or something like that. But anyway, thanks again!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 65 guests