Nifty text color encoding still broken / BatchedRenderer not working

Hey guys,
in this post, @void256 mentioned he fixed the text-encoding problem in nifty:

I’m currently using the stable jME3.0 version with the following nifty version: 1.3.3 (2013-06-20 23:54:54)
It doesn’t contain the “-SNAPSHOT” mentioned in his post, but the date is 3 months older than the fix - So my question is simply, if jME doesn’t contain the newest nifty version and if that’s the case, when it will be updated.

The mentioned error is still there, i.e. the text is displayed correctly (the color-encoding parts are removed) but the whole text is in one color (white). This is when using the default renderer. I tried to use the batched renderer like he mentioned in his post:
[java]NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(mainApplication.getAssetManager(), mainApplication.getInputManager(), mainApplication.getAudioRenderer(), mainApplication.getGuiViewPort(), 2048, 2048);[/java]

But it throws the following error:

Schwerwiegend: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main] java.lang.NoClassDefFoundError: org/jglfont/spi/BitmapFontRenderer at com.jme3.niftygui.NiftyJmeDisplay.( at amara.engine.appstates.NiftyAppState.createNifty( at amara.engine.applications.ingame.client.appstates.NiftyAppState_IngameClient.initialize( at at at at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop( at com.jme3.system.lwjgl.LwjglDisplay.runLoop( at at Caused by: java.lang.ClassNotFoundException: org.jglfont.spi.BitmapFontRenderer at$ at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( ... 10 more

destro :slight_smile:

I think you’re missing “jglfont-core.jar” on your classpath. The last time I’ve checked it was bundled with jMonkeyEngine.jar. I’ve just checked and it is still a part of this source tree: not sure if this is still relevant considering the move to github. But I’m sure that you need that jar on your classpath :slight_smile:

1 Like

Thanks for responding so fast. :slight_smile: I’ve added the jar to the classpath and it seems to work (The default font has changed, but that isn’t problem xD).
I’m still curious why the *.jar isn’t bundled in the 3.0SDK - Neither was it contained in the classpath nor it is available in the “Add Library” list. I added it manually via “Add Jar/Folder”, so I’m fine for now - Just as a hint for the jME developers if this error will pop up for more users.

As i said, thx for helping me out so quick^^

The default font has changed

Actually, I encountered a new problem - I’m not using a default font, but my own font created with the sdk. With the new renderer, it isn’t displayed correctly in one case:

(Left = Default renderer, Right = Batched renderer)

Notice, that the two parts (The chat and the attributes “window”) are in two different nifties and are using the same font - So it seems to work in the one nifty but not in the other. The nifties are set up equally by calling the same methods, just the input *.xml is different.

The xml are as following: (I removed some unnecessary parts, as the xml is really large^^)

Attributes thingy:
[xml]<?xml version="1.0" encoding="UTF-8"?>


[xml]<?xml version="1.0" encoding="UTF-8"?>


Both are using the Interface/fonts/Verdana_12.fnt. The nifties are created by calling: (First, the attributes thing, then the chat window)
[java]public Nifty createNifty(String filePath){
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(mainApplication.getAssetManager(), mainApplication.getInputManager(), mainApplication.getAudioRenderer(), mainApplication.getGuiViewPort(), 2048, 2048);
Nifty nifty = niftyDisplay.getNifty();
goToScreen(nifty, “start”);
return nifty;

Do you have any clues why it doesn’t work with the new renderer? Maybe it is related to the fact, that I use two nifties?

EDIT: I tried only using the attributes-window-nifty (so the chat nifty is never created) and the problem is still there - So I guess, it has to be related to the xml file.

It seems the nifty is using my font Interface/fonts/Verdana_18.fnt in the attributes-window. oO
Also, if I let the <text id=“player_name” …/> use the Verdana_18 font, the rest of the attributes-text-elements seem to work again and use the Verdana_12 font (and even the player_name text element is using a mix between 18 and 12):

I highly assume there is some bug inside the new nifty renderer related to font-caching… Otherwise I couldn’t explain this behaviour. Very strange…

EDIT: Yeah, I can insert a dummy screen that is never called in front of my start-screen like this:


Then, it seems to use the right fonts in the attributes-window (Verdana_12 in all of them):

EDIT2: But if using this “dummy” screen, text fonts in the layers under the attributes-window-layer are messed up (Verdana_18 declared, Verdana_12 used)… I guess, finding a workaround isn’t worth the time. :smiley: