Page 1 of 1

I've used setDefaultFilter but the text is still too pixelated

Posted: Mon Dec 21, 2020 11:29 pm
by Shadow3489

Code: Select all

    Class = require 'class'
push = require 'push'

WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720

VIRTUAL_WIDTH = 432
VIRTUAL_HEIGHT = 243


function love.load()

    love.window.setTitle('Maze')


    love.graphics.setDefaultFilter('nearest', 'nearest')

    smallFont = love.graphics.newFont('HARRYP__.TTF', 25)
    
    push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
        fullscreen = false,
        vsync = true,
        resizable = false,
    })
end


function love.draw()
    push:apply('start')

    love.graphics.clear(30 / 255, 30 / 255, 50 / 255, 1)

    love.graphics.setFont(smallFont)
    love.graphics.printf('Hello, world!', 0, VIRTUAL_HEIGHT / 2 - 6, VIRTUAL_WIDTH, 'center')

    push:apply('end')
end

I've tried to change the font size but it still comes out pixelated. But I've seen others use a similar code to this and their text comes out all crisp and clear.

Re: I've used setDefaultFilter but the text is still too pixelated

Posted: Tue Dec 22, 2020 3:24 pm
by pgimeno
Can you maybe post a screenshot that allows us to get an idea of what you mean?

Re: I've used setDefaultFilter but the text is still too pixelated

Posted: Wed Dec 23, 2020 12:10 am
by Shadow3489
pgimeno wrote: Tue Dec 22, 2020 3:24 pm Can you maybe post a screenshot that allows us to get an idea of what you mean?
Sure thing.

Re: I've used setDefaultFilter but the text is still too pixelated

Posted: Wed Dec 23, 2020 1:10 am
by sphyrth
Getting your font the way you want is a different beast of a problem.

Re: I've used setDefaultFilter but the text is still too pixelated

Posted: Wed Dec 23, 2020 1:21 am
by slime
Using mono font hinting might help:

Code: Select all

smallFont = love.graphics.newFont('HARRYP__.TTF', 25, "mono")

Re: I've used setDefaultFilter but the text is still too pixelated

Posted: Wed Dec 23, 2020 3:01 am
by Shadow3489
slime wrote: Wed Dec 23, 2020 1:21 am Using mono font hinting might help:

Code: Select all

smallFont = love.graphics.newFont('HARRYP__.TTF', 25, "mono")
It has made the text much more clearer, but a couple of letters have joined together. I don't know if it's supposed to be like that or not.

Re: I've used setDefaultFilter but the text is still too pixelated

Posted: Wed Dec 23, 2020 3:28 pm
by ReFreezed
The font was probably not made to handle such small sizes.