From 8a9f9d880da83877206d0a52d03c784e936d3814 Mon Sep 17 00:00:00 2001 From: Brian Muramatsu Date: Wed, 16 Feb 2011 11:40:06 -0800 Subject: [PATCH] Fix Paint#breakText(char[]..) JavaDoc The JavaDoc says that if the "...count is negative then the characters before index are measured in reverse order. This allows for measuring the end of string." However, the native code doesn't work its way backwards from the given index when the count is negative. It always passes Skia the substring starting from index and the absolute value of count. Its better to fix the JavaDoc rather than the behavior, since this API is public and has been this way for some time. It is also used by TextUtils.ellipsize indirectly, so its best to avoid breaking that sensitive code. Change-Id: I8bd51def6ec98251e355370710eb44f58fb737c4 --- graphics/java/android/graphics/Paint.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index d8a7f9d57c7ad..0a23bae18e87c 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -1254,9 +1254,7 @@ public class Paint { * @param text The text to measure * @param index The offset into text to begin measuring at * @param count The number of maximum number of entries to measure. If count - * is negative, then the characters before index are measured - * in reverse order. This allows for measuring the end of - * string. + * is negative, then the characters are measured in reverse order. * @param maxWidth The maximum width to accumulate. * @param measuredWidth Optional. If not null, returns the actual width * measured.