gdx-fontpack - Yet Another Font Packer

I felt there wasn’t a wide selection of robust and open-source bitmap font tools for OSX and Linux, so I decided to write my own. It uses FreeType (through Gdx-Freetype) under the hood, and has a few extra features to boot:

[]Packing multiple fonts and sizes into a single texture atlas
[
]Outer glow and drop shadow
[]OpenGL testing view
[
]Export as plain-text or XML (for other frameworks, like Pixi.js)

You can also use the codebase or command-line tool for some other features, like per-font settings. See the test here for example.

TODO:
[]More effects, like outline and gradients
[
]Supersampling
[]JSON file and “FontMap” utility for LibGDX games
[
]Distance field generation
[*]… other ideas?

Cool! It looks nice.

Padding is extra pixels around glyphs for effects? What is spacing? Seems to do the same, so I think you only need padding.

What about x-advance and y-advance adjustment? Often you set the padding to make glyphs bigger so you can have effects, then set the advance to the inverse of the padding, so the padding doesn’t affect the distance between glyphs when text is drawn. Sometimes you need a pixel or two extra in the advance so effects don’t overlap neighboring glyphs.

It uses the guillotine (aka black pawn) packing algorithm? I wonder the difference between TexturePacker2’s maxrects+brute force algorithm. TexturePacker2 can also compute the smallest size image that fits all regions, even for non-POT.

Does it have kerning?

C:\windows\fonts doesn’t show any fonts in the FileDialog, I guess because it isn’t a real directory. A list of system fonts would be nice. For Sun VMs you can get the font file with some reflection (see Hiero or my recent JGO post about it). Maybe you could only show the system fonts if the reflection hack succeeds.

Test fonts screen is nice. Could scroll. :smiley:

People might want to have multiple fonts with different size for each. Oh, I see you have a Java API for this, nice!

Thanks for the suggestions. :slight_smile:

I will probably remove Spacing since it does the same as padding. (They are a bit different in the API.)

I will look into advance; shouldn’t be too tricky to implement.

It uses PixmapPacker (so black pawn) since that’s what FreeTypeFontGenerator uses. Using TexturePacker2 would be a bit more involved but I could add that as a future TODO. It would be nice to auto-trim the pages to the correct size.

The output FNT file includes kerning.

Thanks for testing on Windows. I will fix the path bug shortly. A list of fonts would indeed be nice.

In future I hope to have a “settings override” button for each font; this way you can select one font and give it a certain size or setting.

I’m using BMFont primarily.
I would be in the market for a new tool since BMFont is a little non-intuitive and strange, but it has the most features.