recently picked up love again(have been playing for a very short timespan with it about a year ago)
My problem is that when i create a new font with, for example a size of 12, it gets way too blurry.
Screenshot:
but it should look like this:
As you can see on the first screen, it is blurred (it's readable, but the text isn't sharp at all, like on the second screen)
The text is drawn onto a canvas, that seems to be the case because the second screen was taken without the print being drawn onto a canvas and it looks just like i want it to look like.
Important code snippets:
creating of canvas
Code: Select all
staticCanvas = love.graphics.newCanvas(677, 343)
Code: Select all
local oldBlend = love.graphics.getBlendMode()
love.graphics.setCanvas(staticCanvas)
love.graphics.clear()
love.graphics.setBlendMode('alpha')
drawcall()
love.graphics.setBlendMode(oldBlend)
love.graphics.setCanvas()
Code: Select all
local font = game.loadFont("consolas.ttf", 12)
love.graphics.setFont(font)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setBlendMode("alpha")
local height = font:getHeight()
local lines = {"Line 1", "Line 2"}
for i = #lines, 1, -1 do
local y = 480 - height - ((#lines - i + 1) * height)
love.graphics.print(lines[i], 5, math.floor(y))
end
Code: Select all
game = {}
function game.loadFont(fontPath, size)
if (not game.fontCache[fontPath]) then
game.fontCache[fontPath] = {}
end
if (not game.fontCache[fontPath][size]) then
game.fontCache[fontPath][size] = love.graphics.newFont("files/fonts/"..fontPath, size)
game.fontCache[fontPath][size]:setFilter("nearest", "nearest")
end
return game.fontCache[fontPath][size]
end
Code: Select all
love.graphics.setBlendMode('alpha', "premultiplied")
love.graphics.draw(staticCanvas, x, y, 0, w / defW, h / defH)
I've also tried to change the filter from "nearest" to "linear", but that doesn't change anything at all!
What i've also tried is removing everything that changed the blendmode, but that didn't change anything either.
For anyone who wants to setup a demo, heres the font: http://www.fontpalace.com/font-details/Consolas/
Sorry for not giving out the .love file, it contains a few files that are private which i don't want to share, but i've pasted everything needed in this post, so you can just copy paste the snippets(mostly).
Anyone can help me figure this out?
Sincerely, nGear