Canvas MeasureStringWidth Android 1.6

stevel05

Expert
Licensed User
Longtime User
I attach a small project that demonstrates an issue with Canvas.MeasureStringWidth, this appears to only be an issue on Android 1.6 (on the emulator at least) And only on the Sans Serif font (Which is also the default font).

I don't have a real 1.6 device to test it on so I was hoping some kind soul would be able to test it.

I've found the problem with lowercase a,e,i,r,f,g and stopped there so there may be others as well.

It probably wouldn't cause too much of an issue as in a sentence these letters would be mixed and some would cancel out, but it could still be far enough out to be annoying.

The label (second white box) duplicates the entered text in the edittext (first white box) and the red line on the label shows the Canvas.MeasureString Width value.

I assume that the developers screwed up the font metrics for this font, it appears to be fixed on 2.1. I am curious to know if it is just the emulator or real devices as well.
 

Attachments

  • MeasureText.zip
    6.6 KB · Views: 372
Cookies are required to use this site. You must accept them to continue using the site. Learn more…