BitmapFont markup crashes in TextField
See original GitHub issueMy app crashes when using BitmapFont markup within a TextField instance (not sure if it happens the same in other scenarios):
TextField tf = new TextField("[RED]h[GREEN]ello", tfs);
I get:
FATAL EXCEPTION: GLThread 8852 Process: es.morse.flash.android, PID: 3177 java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 at com.badlogic.gdx.graphics.g2d.BitmapFontCache.addGlyph(BitmapFontCache.java:628) at com.badlogic.gdx.graphics.g2d.BitmapFontCache.addToCache(BitmapFontCache.java:533) at com.badlogic.gdx.graphics.g2d.BitmapFontCache.addText(BitmapFontCache.java:682) at com.badlogic.gdx.graphics.g2d.BitmapFont.draw(BitmapFont.java:271) at com.badlogic.gdx.scenes.scene2d.ui.TextField.drawText(TextField.java:331) at com.badlogic.gdx.scenes.scene2d.ui.TextField.draw(TextField.java:302) at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:111) at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:58) at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:128) at es.my.App.render(MyApp.java:144) at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:416) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239) waiting for pause synchronization took too long; assuming deadlock and killing
Issue Analytics
- State:
- Created 9 years ago
- Comments:18 (17 by maintainers)
Top GitHub Comments
I don’t see there being a good workaround for this that we can implement in gdx itself. Closing this out.
Everywhere BitmapFont methods are used by TextField, the markup would need to be set to false and restored afterward. Obviously it’s easier for the developer to just use a font without markup enabled. An alternative solution is for TextField to throw an exception if given a font with markup enabled.
On Sat, Jan 10, 2015 at 8:11 PM, davebaol notifications@github.com wrote: