Source:
<code>public void initialize(Text schemaObject) { text = gameLoop.getAssets().getI18N().m(schemaObject.getText()); style = null; String styleRefPath = schemaObject.getStyleref(); TextStyle embeddedTextStyle = schemaObject.getStyle(); if (embeddedTextStyle != null) { style = embeddedTextStyle; } else if (styleRefPath != null) { FileHandle fh = gameLoop.getAssets().resolve(styleRefPath); if (fh != null && fh.exists()) { TextStyle styleRef = gameLoop.getAssets().get(styleRefPath, TextStyle.class); if (styleRef != null) { style = styleRef; } else { Gdx.app.error( "Text", "A style-ref file (" + styleRefPath + ") was declared for this piece of text. However, this file could not be loaded. Text=" + schemaObject.getText()); } } } if (style == null) { FileHandle fh = gameLoop.getAssets().resolve( DEFAULT_TEXT_STYLE_PATH); if (fh != null && fh.exists()) { TextStyle defaultTextStyle = gameLoop.getAssets().get( DEFAULT_TEXT_STYLE_PATH, TextStyle.class); if (defaultTextStyle != null) { style = defaultTextStyle; } else { Gdx.app.error( "Text", "This piece of text does not have style associated and the default text style (" + DEFAULT_TEXT_STYLE_PATH + ") is missing. Text=" + schemaObject.getText()); } } } if (style == null) { style = new TextStyle(); scale = 1.0F; color = Color.WHITE; bitmapFont = gameLoop.getAssets().getDefaultFont(); } else { scale = style.getScale(); es.eucm.ead.schema.components.Color c = style.getColor(); color = c == null ? Color.WHITE : new Color(c.getR(), c.getG(), c.getB(), c.getA()); String fontFile = style.getFont(); if (fontFile == null <START> || !gameLoop.getAssets().resolve(fontFile).exists()) { <END> bitmapFont = gameLoop.getAssets().getDefaultFont(); } else { bitmapFont = gameLoop.getAssets().get(style.getFont(), BitmapFont.class); } } bounds = bitmapFont.getBounds(text); }</code><technical_language>necessary check if font file exists</technical_language>

Target:
public void initialize(Text schemaObject) { text = gameLoop.getAssets().getI18N().m(schemaObject.getText()); style = null; String styleRefPath = schemaObject.getStyleref(); TextStyle embeddedTextStyle = schemaObject.getStyle(); if (embeddedTextStyle != null) { style = embeddedTextStyle; } else if (styleRefPath != null) { try { style = gameLoop.getAssets().get(styleRefPath, TextStyle.class); } catch (GdxRuntimeException e) { Gdx.app.error( "Text", "A style-ref file (" + styleRefPath + ") was declared for this piece of text. However, this file could not be loaded. Text=" + schemaObject.getText()); } } if (style == null) { try { style = gameLoop.getAssets().get(DEFAULT_TEXT_STYLE_PATH, TextStyle.class); } catch (GdxRuntimeException e) { Gdx.app.error( "Text", "This piece of text does not have style associated and the default text style (" + DEFAULT_TEXT_STYLE_PATH + ") is missing. Text=" + schemaObject.getText(), e); } } if (style == null) { style = new TextStyle(); scale = 1.0F; color = Color.WHITE; bitmapFont = gameLoop.getAssets().getDefaultFont(); } else { scale = style.getScale(); es.eucm.ead.schema.components.Color c = style.getColor(); color = c == null ? Color.WHITE : new Color(c.getR(), c.getG(), c.getB(), c.getA()); String fontFile = style.getFont(); if (fontFile == null) { bitmapFont = gameLoop.getAssets().getDefaultFont(); } else { bitmapFont = gameLoop.getAssets().get(style.getFont(), BitmapFont.class); } } bounds = bitmapFont.getBounds(text); }