This is my first productive application in C#. It allows to export specific truetype font into a folder with different colors and sizes as bitmaps. Exports the selected glyphs in PNG format so that they can be used in OpenGL games. Here's the screen shot.

Kerning tells you how closely you're meant to place those images next to each other, it's how you get nicely rendered fonts. It's not about the width of the characters as much as its about the gap you're meant to place between any given pair of characters.

and trimming the image so that they have only the visible character and no empty space between characters. You can see that in the screen shot.

Look at your first screenshot: Sample Text. Use the font you exported there to draw Sample Text, and I bet that you will introduce a massive gap between the l and e of Sample, and between the T and e of Text.

I don't know any. You could start by looking at the Wikipedia page (and maybe browsing some of the other pages in the Typography category).

If you measure individual characters and then pairs of characters you should be able to build up a table of advances which would work for a first approximation. Of course, then you get into issues with sub-pixel placements, and you might be worried by ClearType patents...

How are you parsing TTF information? Most frameworks offer some sort of kerning data along with the glyph size.

Some other notes:

- For LWJGL applications, it's usually desirable to have a single image (PNG or other format) that holds all glyphs. This way we can take advantage of texture atlases which improves sprite batching. Right now it seems like each glyph holds RGBA data, which seems useful for a CPU-based renderer, but would involve a bit more work for a GPU-based renderer (i.e. packing into a texture). You can look into Black Pawn packing algorithm for a fast and easy to implement texture packer. Or you can look into a tool like TexturePacker2.

- What's up with the transparency? It looks a bit choppy around the edges and doesn't seem to blend well with the background.

The only way to easily calculate kerning using normal Java APIs is to draw every pair of letters next to each other and see how the advance between them differs from the normal advance. For any difference != 0.0, that's the kerning for that pair of letters.

I have a class here (part of Hiero) that can read kerning from a TTF file. I use some reflection magic here to try to get the TTF file on Sun VMs if all you have is an AWT Font instance.

I wrote this article about the various tools for generating bitmap fonts. We can add your tool if you like. As I wrote there, the BMFont tool does the best job due to supersampling with FreeType, especially at small sizes. I wish Hiero could do this. Hiero4 in gdx-tools is a prototype for a FreeType based tool using MatthiasM's font renderer he made for TWL. It works but isn't really finished and doesn't do supersampling. Also it means no effects, though that can be done in Photoshop if padding is added to the glyphs.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org