Merge "Make ellipsis START and MIDDLE grapheme cluster aware."
This commit is contained in:
committed by
Android (Google) Code Review
commit
9123ced2fe
@@ -279,7 +279,9 @@ class MeasuredText {
|
||||
if (width < 0.0f) break;
|
||||
i--;
|
||||
}
|
||||
while (i < limit - 1 && mChars[i + 1] == ' ') i++;
|
||||
while (i < limit - 1 && (mChars[i + 1] == ' ' || w[i + 1] == 0.0f)) {
|
||||
i++;
|
||||
}
|
||||
return limit - i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1029,8 +1029,10 @@ public class StaticLayout extends Layout {
|
||||
|
||||
for (i = len; i > 0; i--) {
|
||||
float w = widths[i - 1 + lineStart - widthStart];
|
||||
|
||||
if (w + sum + ellipsisWidth > avail) {
|
||||
while (i < len && widths[i + lineStart - widthStart] == 0.0f) {
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1076,9 +1078,11 @@ public class StaticLayout extends Layout {
|
||||
float w = widths[right - 1 + lineStart - widthStart];
|
||||
|
||||
if (w + rsum > ravail) {
|
||||
while (right < len && widths[right + lineStart - widthStart] == 0.0f) {
|
||||
right++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
rsum += w;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user