tags:

views:

462

answers:

3

The title pretty much sums it up - its the easiest thing in the world in C++ and Windows, but Java seems to struggle with this issue.

I would like to stay away from solutions involving loading bitmaps of fonts, and instead try go for a native truetype font loader, if possible. Kerning and antialiasing is quite important in my application.

+1  A: 

Use the JOGL/Java 2D bridge: render the font on a texture.

Check out "Java 2D and JOGL"[1]

[1]: http://weblogs.java.net/blog/campbell/archive/2007/01/java_2d_and_jog.html ""

A: 

JOGL is pretty good. I've used Processing (processing.org) before that renders nice text. Yes, C++ and OpenGL under Windows does seem easy as the Font management is different (Linux and MacOSX = Much harder to do text with OpenGL I've found)

Oni
A: 

JOGL has a class, TextRenderer, which should do what you want. It accepts a Java "Font" object, and I think you can specify any ttf file for such objects. It does also support antialiasing, I'm not sure what kerning is but probably that too. :)

Unfortunately the JOGL docs are currently... missing. Dunno where they went, hopefully they'll be back soon (in a day or two). Otherwise I would link you to the documentation for the class. Sorry!

Ricket