Tool: simple love2d image fonts

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
davidkonsumer
Prole
Posts: 5
Joined: Thu Dec 28, 2017 12:34 am

Tool: simple love2d image fonts

Post by davidkonsumer »

I made a simple little html tool for assembling image-fonts, as I need extended characters quickly. You can use it online, or locally (with attached file). The main thing that is different from other tools is you need those lines to tell love how spacing works.

https://lovefont.surge.sh/

* open the tool in a browser
* set the characters you want in the first box
* set the font (it's CSS-style, so like "16px monospace") more fonts may be added later, but for now, it's just the fonts built-in to your browser, and whatever you have installed on your system (by name). The input box will match the style so you can see it without the the lines.
* set text (black) and spacer (red) colors to something different from each other. The can be anything, they just need to be different, so I use red for black text.
* Click download to save the font-image

You can use it in your code, like this:

Code: Select all

local font = love.graphics.newImageFont( "font.png", [[ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=_+!@#$%^&*()[]{}\|;':",./<>?↥↧↤↦]] )
love.graphics.setFont( font )
love.graphics.setBackgroundColor( 1,1,1,1 )

function love.draw()
    love.graphics.print( "This is a test of the font. ↥↧↧↧", 0, 0 )
end
Just make sure the character-set is the same as you entered in the tool , and I use [[TEXT]] to not have to worry about escaping it.
Attachments
Example output
Example output
font.png (26.04 KiB) Viewed 6235 times
lovefontmaker.zip
(1.1 KiB) Downloaded 190 times
fontdemo.love
Demo usage
(26.67 KiB) Downloaded 180 times
Post Reply

Who is online

Users browsing this forum: deb75, yetneverdone and 11 guests