1
\$\begingroup\$

enter image description here

I'm an artist. I have several pixel art fonts prepared like so. My platform, Godot, accepts only TrueType and FNT file formats. My images are of raster pixels so obviously a conversion needs to take place. Vector graphics are fine, but I'd like to keep the pixel squares in my design and have them remain aligned with the pixels on screen.

Is anyone aware of a method to build a font from a PNG without too many headaches? I could always make my own text writer using sprites, but that sounds like meaningless reduplication of effort when I Godot provides such useful Label nodes.

\$\endgroup\$
5
  • \$\begingroup\$ superuser.com/questions/48879/… \$\endgroup\$ – dot_Sp0T Nov 4 '20 at 20:54
  • \$\begingroup\$ It wouldn't be too hard with the libpng and several lines of C or C++, but I understand you're not that much into prograaming (="headache" :-)). Seems like the problem has been addressed before: gamedev.stackexchange.com/questions/154097/…. Once you have a true type font you can do anything. \$\endgroup\$ – a_donda Nov 4 '20 at 23:35
  • \$\begingroup\$ The headache isn't the coding, it's the integration into the existing API. I want to use a font, not reprogram a GUI from scratch just because I can. \$\endgroup\$ – Lake Nov 5 '20 at 1:44
  • \$\begingroup\$ If coding's not a problem: usually one loads a font a creates a texture for rendering, here it's the other way round, there's texture and we must create a font. To load the texture: use libpng or something ready made like stb_image, to create a font use freetype2. Can't lookup the exact calls right now because freetype documentation is unreachable for me but it shouldn't be that magical ... Or maybe there are even converters online, idk, ... \$\endgroup\$ – a_donda Nov 5 '20 at 8:17
  • 1
    \$\begingroup\$ I just realized there's an answer in form of a plugin for godot that creates a font from a bitmap image. godotforums.org/discussion/24499/…. Headaches averted :-) \$\endgroup\$ – a_donda Nov 5 '20 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.