v0.7.5b: added additional handling for missing characters
This commit is contained in:
parent
1dd4f66acd
commit
84fa9daa5f
|
@ -93,7 +93,8 @@ public class RenderedText extends Image {
|
||||||
GlyphLayout glyphs = new GlyphLayout( font, text);
|
GlyphLayout glyphs = new GlyphLayout( font, text);
|
||||||
|
|
||||||
for (char c : text.toCharArray()) {
|
for (char c : text.toCharArray()) {
|
||||||
if (font.getData().getGlyph(c) == null){
|
BitmapFont.Glyph g = font.getData().getGlyph(c);
|
||||||
|
if (g == null || (g.id != c)){
|
||||||
Game.reportException(new Throwable("font file " + font.toString() + " could not render " + c));
|
Game.reportException(new Throwable("font file " + font.toString() + " could not render " + c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,7 @@ public class RenderedText extends Image {
|
||||||
//We use the xadvance of the last glyph in some cases to fix issues
|
//We use the xadvance of the last glyph in some cases to fix issues
|
||||||
// with fullwidth punctuation marks in some asian scripts
|
// with fullwidth punctuation marks in some asian scripts
|
||||||
BitmapFont.Glyph lastGlyph = font.getData().getGlyph(text.charAt(text.length()-1));
|
BitmapFont.Glyph lastGlyph = font.getData().getGlyph(text.charAt(text.length()-1));
|
||||||
if (lastGlyph.xadvance > lastGlyph.width*1.5f){
|
if (lastGlyph != null && lastGlyph.xadvance > lastGlyph.width*1.5f){
|
||||||
width = glyphs.width - lastGlyph.width + lastGlyph.xadvance;
|
width = glyphs.width - lastGlyph.width + lastGlyph.xadvance;
|
||||||
} else {
|
} else {
|
||||||
width = glyphs.width;
|
width = glyphs.width;
|
||||||
|
|
|
@ -316,7 +316,9 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||||
parameters.characters = "";
|
parameters.characters = "";
|
||||||
parameters.packer = packer;
|
parameters.packer = packer;
|
||||||
|
|
||||||
fonts.get(generator).put(size, generator.generateFont(parameters));
|
BitmapFont font = generator.generateFont(parameters);
|
||||||
|
font.getData().missingGlyph = font.getData().getGlyph('<27>');
|
||||||
|
fonts.get(generator).put(size, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fonts.get(generator).get(size);
|
return fonts.get(generator).get(size);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user