Can't help you to fix this but have researched the change...

Source for the return value of Paint.measureText I see:
Android 17
  return w*mInvCompatScaling;
Android 18
  return (float) Math.ceil(w*mInvCompatScaling);

The change was done for the follow reasons:
https://github.com/android/platform_frameworks_base/commit/8e04840f38a16f806754dfca3de50c2548e67913



On Tuesday, December 10, 2013 8:45:45 PM UTC, Ab wrote:
>
> 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.

Reply via email to