(SOLVED) Two Bitmap fonts within the same nifty screen

Hi,
I am using a quite simple startscreen based on Nifty. It contains only some text elements and some radio buttons of 2 Button groups.
Technically it’s working, but when I try to use use another bitmap font for the text and for the labels of the radio buttons, it wont do as wanted.

example 1 (I use the font parameter to assign different .fnt file)

<text text="Ball Art" font="Interface/Fonts/ArialBold.fnt" color="#ff0000" width="99%" height="20%"/>
.
.
.
<control id="cl1" name="label" text="Rugby" align="right" width="100%" height="100%" font="Interface/Fonts/ErasLightITC.fnt" color="#0000ff"/>

But the Screen only use the first used font, even if I test 2 text elements.

example 2 (second text directly beneath the first)

<text text="Ball Art" font="Interface/Fonts/ArialBold.fnt" color="#ff0000" width="99%" height="20%"/>
<text text="second text" font="Interface/Fonts/ErasLightITC.fnt" color="#0000ff" width="99%" height="20%"/>
1 Like

Using styles works for us at least:

    <style id="text">
        <attributes font="Interface/Fonts/Frontend14.fnt" color="#bbbcbb" />
    </style>
    <style id="menuTextSmall">
        <attributes font="Interface/Fonts/Frontend20.fnt" color="#bbbcbb" />
    </style>

    <text style="text" text="${menu.71}" align="center">

(full source: OpenKeeper/MainMenu.xml at master · tonihele/OpenKeeper · GitHub)

1 Like

@tonihele Thanks for the fast reply!

Because of my holiday and corona quarantine I can right away test it

unfortunately it doesn’t seem to look an other way. May by I’ve made a mistake somewhere else in the screen XML which causes this behavior. I think on first I will just use the text color for differ the display of the text and the labels, then I have a closer look to the Nifty tutorial to find out what I’ve missed.

Are you sure that your fonts are actually any different to begin with? It works for us nicely, so I doubt your setup a bit.

I tried to rebuild the screen from scratch, and found out that my bitmap fonts got to blame.
After I converted some new fonts from TTF to bitmap the behavior vanished.
It seems that I’ve somehow do a mistake while converting the first ones.

1 Like

looks like all fonts converted with JME IDE on my ubuntu 20.10 system has the same error the ones I copied from my old windows 10 environment still works. This sounds wired and I hope I ve just done a wrong configuration anywhere.

1 Like

How can I close this thread?

I recently notice some font setting within a nifty.xml (probably put there by myself, while I first try to get to know with nifty and forgotten there). Thats why all new Bitmapfonts failed.

1 Like