jME-TTF is a True Type Font(.ttf) rendering system for jMonkeyEngine3.1 and newer. With this library you can render UI text styles loaded directly from a true type font file at run-time. Characters from the ttf file are written to a dynamically sized texture atlas and then rendered on screen using a series of quads that display each character from the atlas. When requesting a text string to display jME-TTF looks through the string to see if any characters are missing from the atlas and if so adds them, expanding the size of the atlas texture as necessary.
In addition to that you can opt to render scaleable text styled from a true type font file in your 3D or 2D scenes. jME-TTF can triangulate a mesh from the glyph outline of each requested character, caching new glyph meshes, and apply a material that interpolates curved sections of the glyph’s contours using quadratic bezier formulas. The result is a text that can scale without pixelaltion and is fully compatible with modern GPU anti-aliasing methods.
jME-TTF provides a variety of conveniences such as getting the width of a line of text in pixels or world units, the line height, visual heights, scaling and kerning, you can even get a texture displaying blurred text. Formatting options such as vertical/horizontal alignment and text wrapping are also available. The zip file download contains the jME-TTF.jar library, javadoc and source code. jME-TTF depends upon Google’s Sfntly librari which is included in the download.
Fonts are easy enough to load:
assetManager.registerLoader(TrueTypeLoader.class, "ttf"); TrueTypeKeyMesh ttk = new TrueTypeKeyMesh("Interface/Fonts/myTypeface.ttf", Style.Plain, 16); TrueTypeFont ttf = (TrueTypeMesh)assetManager.loadAsset(ttk); TrueTypeContainer ttc = ttf.getFormattedText(new StringContainer(ttf, "Hello\nWorld"), 0, ColorRGBA.Blue); rootNode.attachChild(ttc);
jME-TTF is licensed under the Free Public License 1.0.0 while the jmescher triangulation included in the library is licensed under New BSD. Sfntly is licensed under Apache 2.0.
Anyway you can download the library and view information on how to use it on my website here: http://1337atr.weebly.com/jttf.html