mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-23 16:19:44 +00:00
Fix text width measurement on Android when there are spaces at the start/end of the string (bounds doesn't handle that). Fixes 10174
This commit is contained in:
parent
3ecd7b4c02
commit
495532f0ff
@ -26,10 +26,8 @@ public class TextRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Point measure(String string, double textSize) {
|
private static Point measure(String string, double textSize) {
|
||||||
Rect bound = new Rect();
|
|
||||||
p.setTextSize((float)textSize);
|
p.setTextSize((float)textSize);
|
||||||
p.getTextBounds(string, 0, string.length(), bound);
|
int w = (int)p.measureText(string);
|
||||||
int w = bound.width();
|
|
||||||
int h = (int)(p.descent() - p.ascent() + 2.0f);
|
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
|
// 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
|
// OpenGL does not like - each line must be 4-byte aligned
|
||||||
|
Loading…
Reference in New Issue
Block a user