Why does my image font not work?

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
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

Why does my image font not work?

Post by Ratchet »

Other Image fonts work good. Why this one don't?

Image

Code: Select all

function love.load()
	bombing = love.graphics.newImageFont("bombing.png", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-;:_!\"$/()=?#*+", 1)
end

function love.draw()
	love.graphics.setFont(bombing)
	love.graphics.print("Hello World 123", 0, 0)
end
Last edited by Ratchet on Thu Jun 06, 2019 12:05 pm, edited 1 time in total.
macOS 10.14 Mojave | LÖVE 11.2
User avatar
pgimeno
Party member
Posts: 3655
Joined: Sun Oct 18, 2015 2:58 pm

Re: Why my image font doesn't work?

Post by pgimeno »

It has some pink with alpha = 1/255 which seems to be confusing the separator.

I've fixed it with gimp, first selecting the pink by colour with threshold 0, then transferring the alpha to a layer mask, applying a threshold to the mask (so that alpha is either 255/255 or 0/255 in the areas that were pink) and saving.

You could suggest in the bug tracker to consider the alpha when separating the characters, to avoid issues like this.
Last edited by pgimeno on Thu Jun 06, 2019 3:47 pm, edited 1 time in total.
User avatar
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

Re: Why does my image font not work?

Post by Ratchet »

Oh, thanks for fixing it. I checked the rgb of the pink separators but not the alpha - no idea where the alpha comes from.
Thank you so much.
macOS 10.14 Mojave | LÖVE 11.2
Post Reply

Who is online

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