Non ASCII chars and com.jme.scene.Text class?

Hello all…

Yes, I'm a JME Noob, so please, bear with me…  :mrgreen:

I've got a question regarding


As a german, i just tried setting a text which contains

"Umlauts"… So, "

Hello oliver1974, welcome into the jme world !

I think that you pointed out a jme bug because umlauts works in the jmetest.text.Test3DFlatText demo, but they don't work with jmetest.text.Test3DText.

I will try to find the cause this night.

i guess this is due to DEFAULT_FONT

No, I think it comes from com.jmex.font2d.Font2D or com.jmex.font2d.Text2D. Because the default font ( contains "

@targ: it's not a bug. due to the nature of com.jme.scene.Text, it's not really possible to have non ascii characters displayed. Text simply uses a texture for displaying the letters and is limited to 256 characters. actually i'm not even sure if the whole texture(it can acually hold 2 character sets) is used.

as of com.jmex.font2d.Text2D, it equally sucks, as it inherits from Text and uses the same methods to display text.

so as far i can see oliver, if you want non-ascii chars you have the following options:

  • if you have onyl a few static text labels, you can simply create some textures for displaying your text
  • use awt to render your text to some texures (but keep in mind that if you have a lot of text you'll get a lot of textures)
  • use one of the existing UI libraries
  • implement your own TextFactory and JmeText

Ok… You are right  :// … But I see that it is possible to create non ascii 3D text because com.jmex.font2d.Text3D doesn't inherit from com.jme.scene.Text.

package jmetest.text;

import java.awt.*;
import java.util.concurrent.*;

import com.jme.math.*;
import com.jme.util.*;
import com.jmex.font3d.*;

public class Test3DNonAscii {
   public static void main(String[] args) throws Exception {
      StandardGame game = new StandardGame("Test 3D Flat Text");
      final DebugGameState debug = new DebugGameState();
      GameTaskQueueManager.getManager().update(new Callable<Object>() {
         public Object call() throws Exception {
            Font3D font = new Font3D(new Font("Arial", Font.PLAIN, 24), 0.001f, true, true, true);
            Text3D text = font.createText("Testing

Hallo oliver! Ist die 1974 dein "Jahrgang"? Ist n

This info should be written up as a Wiki article!

Thank you, but what I wrote is basically the same as this (just with text):

Hallo oliver! Ist die 1974 dein "Jahrgang"? Ist n

I'm sorry, but what was the reason only 256 glyphs are generated?

If you modify generation procedure to

        glyph3Ds=new Glyph3D[font.getNumGlyphs()];

        for (int g = 0; g < font.getNumGlyphs(); g++) {

you can display all the glyphs the font have.

Sorry, was a bad idea. But we can use a Map<Character,Glyph3D> instead of array and fill it lazily when requesting a char in getGlyph(char c). Also there is a Font.getMissingGlyphCode() so we can draw absent glyphs correctly. In this manner it will be possible to draw all the unicode chars (of cause if Font supports them)