Permalink
Browse files

Fix text width measurement on Android when there are spaces at the st…

…art/end of the string (bounds doesn't handle that). Fixes 10174
  • Loading branch information...
hrydgard committed Nov 22, 2017
1 parent 3ecd7b4 commit 495532f0ff93f87f4d4715a50808b22e3b3f05e4
Showing with 1 addition and 3 deletions.
  1. +1 −3 android/src/org/ppsspp/ppsspp/TextRenderer.java
@@ -26,10 +26,8 @@ public static void init(Context ctx) {
}
}
private static Point measure(String string, double textSize) {
Rect bound = new Rect();
p.setTextSize((float)textSize);
p.getTextBounds(string, 0, string.length(), bound);
int w = bound.width();
int w = (int)p.measureText(string);
int h = (int)(p.descent() - p.ascent() + 2.0f);
// Round width up to even already here to avoid annoyances from odd-width 16-bit textures which
// OpenGL does not like - each line must be 4-byte aligned

0 comments on commit 495532f

Please sign in to comment.