question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BitmapFont markup crashes in TextField

See original GitHub issue

My 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:closed
  • Created 9 years ago
  • Comments:18 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
badlogiccommented, Feb 2, 2015

I don’t see there being a good workaround for this that we can implement in gdx itself. Closing this out.

0reactions
NathanSweetcommented, Jan 10, 2015

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:

@NathanSweet https://github.com/NathanSweet Not looked into the code yet, but does TextField use methods computeVisibleGlyphs or getBounds of BitmapFont ? If so, they are likely invoked from outside of the drawing procedure.

— Reply to this email directly or view it on GitHub https://github.com/libgdx/libgdx/issues/2645#issuecomment-69467842.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-colored text in libgdx - java - Stack Overflow
Libgdx offers color markup, which must first be enabled on the BitmapFont with font.getData().markupEnabled = true;. Text rendered with that font will look ......
Read more >
Godot Engine | Guys when I use bitmap font my game crash (godot 2 ...
Can an instanced scene send a signal back to the scene that instanced it? I have one scene (Aliens) that instances a bomb...
Read more >
Iggy Development History - RAD Game Tools
bugfix: Font character fonts w/ multiple separate shapes could render wrong in the vector path; bugfix: Avoid possible crash if an exception is...
Read more >
Gdx freetype - libGDX
However, there is a downside: BitmapFonts rely on an image, so you have to scale. ... especially on gdx-freetype-gwt, to avoid glitched fonts...
Read more >
BMFont - AngelCode.com
Bitmap Font Generator. This program will allow you to ... Fixed crash with large fonts when Windows API incorrectly reported negative width for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found