Special characters like ç and õ don't work using Nifty GUI!

Hi monkeys!

So, after a lot of trouble with Nifty, I finally created a simple menu. It looks great for me, but the only problem I’m getting is missing special characters. Here is how the GUI looks like in the editor:

The label of the button “Opções” (which means Options) looks fine. It may not look centered, but ingame, it is.

Also, the XML is using UTF-8.

Now, the same GUI in-game:

Instead of “Opções”, it only shows “Opes”. This is my problem.

I’m pretty sure the problem is the font used for the label. However, it seems I can’t change the font of it.

So, is there a way to change the font, or should I change/create a new style for the button?


I haven’t checked,
but I think the font contains some special characters, but not the ones you use.
Changing the font is pretty easy: Just do font="/Interface/MyCoolFont.fnt" in the xml.
You need an fnt and an image file that the SDK can generate from one of the fonts installed on your system.

Thanks for the reply @Robbi_Blechdose. I tried to add the font variable to the control. I tried Interface/Fonts/Default.fnt, Interface/Fonts/Console.fntand even my font for the title screen. It doesn’t change.

It’s most likely due to the fact that those fonts have not been generated with all those characters in them. You might need to regenerate the font files with all your characters in the character map.

So, what should I do? I don’t even know what is the font Nifty uses bye default.

Generate a font and set Nifty to use it. Surely you have some fonts in your computer that have the characters you need. Generate bitmap font out of them, either using JME JDK’s font tool or AngelFont tool.

It could be generated with this free tool: BMFont - AngelCode.com
It’s a Windows programm and the forum is here: http://www.gamedev.net/forum/49-angelcode/
It’s also open source now

Thanks guys. I know how to generate fonts. I created one for the title. The problem is, as I said above: I can’t change the font of a button. I tried to add the font variables and use 3 different fonts, but it doesn’t show up.

You need to override Nifty’s default fonts with a style. Most of their controls derive from one base font change. You can look it up in their repo.