Little background..
I'm in the process of making an OpenGL game using Java and LWJGL. I've written a TextRenderer
-class that renders text using cached pages of glyphs. The glyphs itself are rendered in Java2D to BufferedImage
s and packed into texture pages along with the glyph measurements. TextRenderer
draws the characters as textured quads, using the cached information.
All this works well, except for one thing: missing kerning. Granted, it's not necessary to have as the text looks fine as it is, but it would improve the quality if I had access to the font kerning information.
And the question is..
Is it possible to obtain the kerning information using plain Java, in a way that would be portable across Windows, Linux and MacOS X? Back when I wrote the TextRenderer
I briefly looked around but could not find such a way..
One possible solution
If there is no way of doing this in pure Java, I was thinking of writing a separate tool using Freetype. As listed in their features page:
FreeType 2 provides information that is often not available from other similar font engines, like kerning distances, glyph names, vertical metrics, etc.
The tool would store the kerning pairs for common characters into a file that my text renderer would load in and make use of. So this is probably what I will do if you guys don't come up with a better alternative. :)