Sunday, July 22, 2012

[android-developers] Paint getTextPath not working as expected

Hi there!

The following has been tested on a Galaxy S3 with Android 4.0.4 and on an LG Optimus Speed 2X with Cyanogenmod 9 (i know you don't support that, but I guess it happens on any ICS-Device).

I found, that the "getTextPath(String text, int start, int end, float x, float y, Path path)"-method in the Paint-Class returns a broken path.

When trying to paint the resulting path on the canvas it just won't draw it. however I found out that after using the "Path.setLastPoint(x,y)"-method
the path is drawn correctly apart from the just modified last point.
This problem doesn't occur in Android 2.3 (tested on the LG 2X).

The problem occurs on real devices but I think since hw-acceleration was added to the emulator it doesn't occur on virtual devices anymore (at least on Windows).

I am developing an App that has dynamically growing and shrinking text, and the canvas.drawText()-method does that really badly, because the text size is always rounded before drawing. This makes scaling and rotating of text look extremely choppy and converting the text into a path or a bitmap is the only workaround I could find (and I tried lots of ways). I also saw the problem in many other apps with zoomability (browsers).

I would love to have this problem fixed, but 
(feature request) I'd also love to maybe have a flag in the Paint class that enables high definition text drawing in the canvas.

Thank you!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment