Skip to content

A TrueType font rendering subsystem for jMonkeyEngine

License

Notifications You must be signed in to change notification settings

stephengold/jME-TTF

 
 

Repository files navigation

jME-TTF

jME-TTF is a TrueType rendering system for jMonkeyEngine. With this library, you can render text styles loaded directly from a TrueType font (.ttf) file at runtime. Shapes from the file are written to a dynamically sized texture atlas and then rendered using a series of quads that display individual characters. When presented with a text string to display, jME-TTF scans the string to see if any characters are missing from the atlas, and if so it adds them, expanding the atlas texture as necessary.

jME-TTF Screen

In addition to that you can opt to render scalable 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 pixelization and is fully compatible with modern GPU anti-aliasing methods.

jME-TTF Screen

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.

jME-TTF supports outlined text and also assigns several UV layers that can be taken advantage of in your own custom shaders to create a wide variety of different effects.

jME-TTF Screen

jME-TTF Screen

jME-TTF Screen

jME-TTF depends upon Google's Sfntly library available at https://github.com/rillig/sfntly

You can find more about jME-TTF including usage documentation at http://1337atr.weebly.com/jttf.html