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:
...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/
Answer
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.
No comments:
Post a Comment