I have the following problem with libgdx displaying Cyrillic. I give an example:
this works:
System.out.println("абцдеф");
but it shows nothing:
field = new TextField("абцдеф", style);
And tried without success.
try {
mmm = new String(t.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
// Will it ever be thrown?
}
field = new TextField(mmm, style);
I'll be glad if someone has a solution, many, many will be grateful.
I think there might be some additional information that is missing. Aslong libgdx is using Bitmap-fonts for displaying all kind of text. (TextField is a part of scene2dui I think) The default Bitmap-Generation / Default-libgdx-font might only contain ASCII-code characters and some additional, but no cyrillic.
That's why you would have to provide cyrillic chars manually in your BitmapFont aswell to be able to display them. The relatively new libgdx-extension for generating BitmapFonts out of an .ttf-Asset can also generate the cyrillic characters if you define them: TrueType Fonts in libGDX
Then you'll be also able to use them in your game/app aslong you also define the newly generated font for your TextField / scene2dui style: Libgdx Scene2d - Set actor ( TextField ) padding?
Here are also some tests in the libgdx-repo. Have a look there if there's a matter of missunderstanding: https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/extensions/InternationalFontsTest.java I hope this helps! cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With