I often gets the same problem: Someones creates a nice bitmap font for me in form of a sheet nicely formated into a png, like this:

enter image description here

...and i need to create the angelcode .fnt atlas for using it (into Unity, libGDX, or countless other engines).

Yet, every time I google it, I stumble upon dozen of tools that create .fnt files from rasterized TTF fonts. (BMFont, Fontbuilder, etc.) Correct me if i'm wrong but they don't support exsting images, they always start by generating one from a vector font.

I end up semi-manually creating the file with an ugly script (the format is quite simple), but it's incredibly tedious. Surely there is a much better way to do that? Especially for monospaced fonts which are very easy to partition...

edit: I've made a small javascript tool to solve that. if by any chance you're interested, it's here : http://fontcutter.fbksoft.com/

  • 1
    \$\begingroup\$ if your tool works, could you post the link to it as an answer and accept it? \$\endgroup\$ – user40973 Dec 16 '14 at 12:03
  • \$\begingroup\$ Looking for something like this too. Cannot believe there is no tool for this, I mean a font only holds black/white. How do games get these bitmaps to work as fonts? I guess they let 12 y/o chinese kids write the .fnt? \$\endgroup\$ – Madmenyo Oct 14 '15 at 16:30
  • \$\begingroup\$ Great tool, but I have a question: in the picture above you have spaces before the first A and the !, ? characters, how do you fill these spaces in your tools? using a " " doesn't seems to work as a starting line and if I use any other dummy char, they will be present in the generated config file. Thanks! \$\endgroup\$ – Nock Jan 7 '17 at 8:57

Another solution is if you can get the font with all the letters split (trivial to do if they can be maintained as Iindividual layers in Photoshop or gimp) and named with the letter's id. Hell you could spend some time renaming them yourself after you get the files individually.

Then you could take a lovely open source sprite sheet packer (there's several others as well), and modify it yourself to produce fnt file format instead. Since all of the information would be there already (position of each letter as it's packed in a page, letter size, id, etc...), then it would be completely automatic at that point.

  • 1
    \$\begingroup\$ Yes, at this point, i give up being lazy, i'm investing time to create a tool for that :) \$\endgroup\$ – fabienbk May 7 '14 at 9:40

AFAIK there is no possibility to do that. But when you take a look into a .fnt file, you'll see that it's possible to write it on your own. It's made of some lines of plain-text which are doable in a hour or so i guess.

So the only solution that comes to my mind is writing the .fnt yourself.

EDIT: the resource you have there (this one) contains actually everything that has to be written in your .fnt file.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.