v0.7.5b: improved the font generation process slightly

This commit is contained in:
Evan Debenham 2019-10-14 11:24:54 -04:00
parent 400398e56f
commit 7b23fa1a31

View File

@ -338,12 +338,23 @@ public class AndroidPlatformSupport extends PlatformSupport {
parameters.hinting = FreeTypeFontGenerator.Hinting.None;
parameters.spaceX = -(int) parameters.borderWidth;
parameters.incremental = true;
parameters.characters = "";
if (generator == basicFontGenerator){
//if we're using latin/cyrillic, we can safely pre-generate some common letters
//(we define common as >4% frequency in english)
parameters.characters = "<EFBFBD>etaoinshrdl";
} else {
parameters.characters = "<EFBFBD>";
}
parameters.packer = packer;
BitmapFont font = generator.generateFont(parameters);
font.getData().missingGlyph = font.getData().getGlyph('<27>');
fonts.get(generator).put(size, font);
try {
BitmapFont font = generator.generateFont(parameters);
font.getData().missingGlyph = font.getData().getGlyph('<27>');
fonts.get(generator).put(size, font);
} catch ( Exception e ){
Game.reportException(e);
return null;
}
}
return fonts.get(generator).get(size);