Don't crash when font glyphs are missing
This commit is contained in:
@@ -236,8 +236,12 @@ public class Fonts{
|
||||
}
|
||||
|
||||
public static TextureRegionDrawable getGlyph(Font font, char glyph){
|
||||
Glyph g = font.getData().getGlyph(glyph);
|
||||
if(g == null) throw new IllegalArgumentException("No glyph: " + glyph + " (" + (int)glyph + ")");
|
||||
Glyph found = font.getData().getGlyph(glyph);
|
||||
if(found == null){
|
||||
Log.warn("No icon found for glyph: @ (@)", glyph, (int)glyph);
|
||||
found = font.getData().getGlyph('F');
|
||||
}
|
||||
Glyph g = found;
|
||||
|
||||
float size = Math.max(g.width, g.height);
|
||||
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion(font.getRegion().texture, g.u, g.v2, g.u2, g.v)){
|
||||
|
||||
Reference in New Issue
Block a user