From 7b23fa1a317eddaaf325cd7f367642f68d536a68 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 14 Oct 2019 11:24:54 -0400 Subject: [PATCH] v0.7.5b: improved the font generation process slightly --- .../android/AndroidPlatformSupport.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java index fb8555286..fd286ff05 100644 --- a/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java +++ b/android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android/AndroidPlatformSupport.java @@ -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 = "�etaoinshrdl"; + } else { + parameters.characters = "�"; + } parameters.packer = packer; - BitmapFont font = generator.generateFont(parameters); - font.getData().missingGlyph = font.getData().getGlyph('�'); - fonts.get(generator).put(size, font); + try { + BitmapFont font = generator.generateFont(parameters); + font.getData().missingGlyph = font.getData().getGlyph('�'); + fonts.get(generator).put(size, font); + } catch ( Exception e ){ + Game.reportException(e); + return null; + } } return fonts.get(generator).get(size);