BitmapText max length?

Hi.

I’ve recently synced for the first time in a week or so, and noticed i get this exception when bringing up a bitmap text i use to display a lengthy bit of information:



[java]Exception in thread “LWJGL Renderer Thread” java.lang.IndexOutOfBoundsException: Index: 124, Size: 124

at java.util.ArrayList.RangeCheck(ArrayList.java:547)

at java.util.ArrayList.get(ArrayList.java:322)

at com.jme3.font.QuadList.getQuad(QuadList.java:43)

at com.jme3.font.BitmapFont.updateTextRect(BitmapFont.java:397)

at com.jme3.font.BitmapTextPage.assemble(BitmapTextPage.java:117)

at com.jme3.font.BitmapText.assemble(BitmapText.java:162)[/java]



Forcing the string down to 125 characters seems to work.

Well, that theory is out the window. I get it on other occasions too.

Are you using multiple pages? E.g. is there more than 1 texture for the font?

Not that i know of. I do change the contents of it though;

Init:

[java]

BitmapFont fnt = getAssetManager().loadFont("Interface/Fonts/Default.fnt");

infoText = new BitmapText(fnt, false);

infoText.setBox(new Rectangle(0, 0, 150, 100));

infoText.setText("");

infoText.setColor(ColorRGBA.LightGray);

infoText.setSize( 10 );[/java]



Set text:

[java]infoText.setText( info );[/java]



It seems to be pretty consistent. Ie, it happens always in some instances, and never in others.

There was a = in the for loop.

And I changed some access modifiers from public to package private becuase it is not used outside.

Fixed in svn. rev. 6532

1 Like

No error anymore but long word is not displayed correctly for multi-page text. I’m looking into the problem.

There is a new problem instead. Several of my strings seem mashed up now, with strange cut offs and combinations, even where there were no problems before, like in nifty elements, etc.

Can you provide some test case? Sorry for the trouble.

Try setting the text of the bitmaptext, then replace it with a shorter one. You should see part of the long text where it extends the short one.

Fixed in svn. rev. 6536.

That seems to have done it, thanks.