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

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
Shadow3489
Prole
Posts: 8
Joined: Mon Dec 21, 2020 5:36 am

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

Post 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.
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

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

Post by pgimeno »

Can you maybe post a screenshot that allows us to get an idea of what you mean?
Shadow3489
Prole
Posts: 8
Joined: Mon Dec 21, 2020 5:36 am

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

Post 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.
Attachments
Screenshot 2020-12-23 101000.png
Screenshot 2020-12-23 101000.png (21.29 KiB) Viewed 3701 times
sphyrth
Party member
Posts: 260
Joined: Mon Jul 07, 2014 11:04 am
Contact:

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

Post by sphyrth »

Getting your font the way you want is a different beast of a problem.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

Using mono font hinting might help:

Code: Select all

smallFont = love.graphics.newFont('HARRYP__.TTF', 25, "mono")
Shadow3489
Prole
Posts: 8
Joined: Mon Dec 21, 2020 5:36 am

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

Post 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.
Attachments
Screenshot 2020-12-23 130026.png
Screenshot 2020-12-23 130026.png (736 Bytes) Viewed 3683 times
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

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

Post by ReFreezed »

The font was probably not made to handle such small sizes.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 230 guests