Reputation: 21
I am using the LOVE2d framework, and I am not sure how to use the newImageFont()
function.
I checked the online documentation, but it wasn't very clear on what variable did what. Also, some letters are longer than others, so I don't know if that would ruin the font. I attached an image of the font (sorry if you cant see it, the letters are white). pixel font
Upvotes: 2
Views: 43
Reputation: 586
Just add the key pixels with pure magenta color (255, 0, 255) or {1,0,1}: https://love2d.org/forums/download/file.php?id=23260
main.lua:
local filename = 'pixelfont-11p.png'
local glyphs = " abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/():;%&`'*#=[]\""
local fontImageData = love.image.newImageData(filename)
local font11p = love.graphics.newImageFont(fontImageData, glyphs)
font11p:setFilter( 'nearest', 'nearest' )
function love.draw ()
love.graphics.setFont(font11p)
love.graphics.print (glyphs, 0, 12)
love.graphics.scale (2)
love.graphics.print (glyphs, 0, 12)
love.graphics.scale (2)
love.graphics.print (glyphs, 0, 12)
love.graphics.scale (2)
love.graphics.print (glyphs, 0, 12)
end
Upvotes: 1