BitmapText accessors


I wanted to get access to the translation coordinates of individual letters in a BitmapText in order to add 3d effects to individual letters. But looks like com.jme3.font.BitmapText doesn’t offer an getter for it’s member var Letters, so I wanted to add a public one. Then I see both Letters and LetterQuad are package private.

Can I add the public getter to BitmapText and make Letters and LetterQuad public classes with public getters?

Is there any specific reason for making this all package private? Is it ok to change this?


This code is extremely fragile and those structures in particular are very dangerous to modify directly. Nor do you really have the access required to regenerate the mesh if you mess with them. After all LetterQuad is only used to generate the actual Mesh which itself is just a conventional JME Mesh.

The mesh setup that BitmapText uses before text is set:
Mesh m = getMesh();
m.setBuffer(Type.Position, 3, new float[0]);
m.setBuffer(Type.TexCoord, 2, new float[0]);
m.setBuffer(Type.Color, 4, new byte[0]);
m.setBuffer(Type.Index, 3, new short[0]);

    // scale colors from 0 - 255 range into 0 - 1


This class was not really designed for modifying/animating the letters at runtime and I suspect you will have a better time just modifying the mesh directly. At least you know every letter will be four vertexes.

1 Like

Thanks, will check this out!