I just recently updated my Libgdx project from 1.4.x to 1.6.1. I use BitmapFontCache for my dialogue in my game, drawing a string character by character using BitmapFontCache.draw(start, end). This was working fine in 1.4.x but after making the necessary changes to get 1.6.1 to build, it seems to cause a crash when wrapping is enabled after the last character is displayed. Strangely this does not seem to be a problem with one line strings.
Here is how I add my text:
fontCache.addText( message, fontPosX, fontPosY, fontWidth, Align.left, true);
Then I increment the character count and draw. currentCharacter stops when reaching the end of the string based on its length:
fontCache.draw( batch, 0, currentCharacter );
This worked fine in 1.4.x even with multi-line wrapped strings but seems to cause an out of bounds exception if the lines wraps to a second line (crashes after drawing the last character). Here is the line causing crash in SpriteBatch.
System.arraycopy(spriteVertices, offset, vertices, idx, copyCount);
Is there a new way I need to be calculating the length of the string for drawing? Do I need to use the return GlyphLayout in some way? Or is this perhaps a bug?