KB-20071217-034
From Triled Wiki
- Status: respond received
- author: tomgibara
- link: http://groups.google.com/group/android-developers/msg/0ba1d552b3f74bdc
- Description: Paint.textBreak() methods returns incorrect values for small text sizes
- Confirmed on: m3-rc22a, m3-rc37a SDK versions.
- Steps to reproduce:
Code is taken from original post
private void testTextBreak(float textSize) {
Paint paint = new Paint();
paint.setSubpixelText(true);
paint.setTextSize(textSize);
//we expect to fit approximately 10 X's into this space, no?
int i = paint.breakText("XXXXXXXXXX", true, textSize * 10, null);
Log.i("test", String.format("At text size %3.3f we accommodated %d Xs", textSize, i));
}
...
testTextBreak(100f);
testTextBreak(10f);
testTextBreak(1f);
testTextBreak(0.1f);
testTextBreak(0.01f);
...
Expected behaviour: value returned by breakText() is near 10.
but output:
I/test(1039): At text size 100.000 we accommodated 10 Xs I/test(1039): At text size 10.000 we accommodated 10 Xs I/test(1039): At text size 1.000 we accommodated 10 Xs I/test(1039): At text size 0.100 we accommodated 1 Xs I/test(1039): At text size 0.010 we accommodated 0 Xs
For small text sizes textBreak() returns incorrect values.
