I make heavy use of the Paint.measureText() method and was surprised to
find that in 4.4 thefloat this method returns is always rounded up. In
previous versions, no rounding occurred. I ran the below code on a 4.0.4
device and a 4.4 device. The results for the 4.0.4 device are first, the
results for the 4.4 device are second.
Any suggestions of how I can get unrounded values in 4.4, possibly there is
a new attribute for Paintthat I missed?
@Overrideprotected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Paint p = new Paint();
p.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL));
p.setTextSize(1);
p.setAntiAlias(true);
p.setSubpixelText(true);
Log.e("T", p.measureText("T")+"");
Log.e("h", p.measureText("h")+"");
Log.e("e", p.measureText("e")+"");
Log.e("L", p.measureText("L")+"");
Log.e("a", p.measureText("a")+"");
Log.e("z", p.measureText("z")+"");
Log.e("y", p.measureText("y")+"");
Log.e("w", p.measureText("w")+"");}
4.0.4:
0.59375 0.5625 0.515625 0.546875 0.546875 0.5 0.5 0.75
4.4:
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.