Merge "Fix bug #6661824 Hebrew Text can be clipped" into jb-dev

This commit is contained in:
Fabrice Di Meglio
2012-06-14 10:50:36 -07:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 7 deletions

View File

@ -1696,8 +1696,14 @@ public abstract class Layout {
return text.getSpans(start, end, type);
}
private char getEllipsisChar(TextUtils.TruncateAt method) {
return (method == TextUtils.TruncateAt.END_SMALL) ?
ELLIPSIS_TWO_DOTS[0] :
ELLIPSIS_NORMAL[0];
}
private void ellipsize(int start, int end, int line,
char[] dest, int destoff) {
char[] dest, int destoff, TextUtils.TruncateAt method) {
int ellipsisCount = getEllipsisCount(line);
if (ellipsisCount == 0) {
@ -1711,7 +1717,7 @@ public abstract class Layout {
char c;
if (i == ellipsisStart) {
c = '\u2026'; // ellipsis
c = getEllipsisChar(method); // ellipsis
} else {
c = '\uFEFF'; // 0-width space
}
@ -1785,7 +1791,7 @@ public abstract class Layout {
TextUtils.getChars(mText, start, end, dest, destoff);
for (int i = line1; i <= line2; i++) {
mLayout.ellipsize(start, end, i, dest, destoff);
mLayout.ellipsize(start, end, i, dest, destoff, mMethod);
}
}
@ -1890,4 +1896,6 @@ public abstract class Layout {
/* package */ static final Directions DIRS_ALL_RIGHT_TO_LEFT =
new Directions(new int[] { 0, RUN_LENGTH_MASK | RUN_RTL_FLAG });
/* package */ static final char[] ELLIPSIS_NORMAL = { '\u2026' }; // this is "..."
/* package */ static final char[] ELLIPSIS_TWO_DOTS = { '\u2025' }; // this is ".."
}

View File

@ -745,7 +745,8 @@ public class StaticLayout extends Layout {
}
float ellipsisWidth = paint.measureText(
(where == TextUtils.TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS : ELLIPSIS_NORMAL);
(where == TextUtils.TruncateAt.END_SMALL) ?
ELLIPSIS_TWO_DOTS : ELLIPSIS_NORMAL, 0, 1);
int ellipsisStart = 0;
int ellipsisCount = 0;
int len = lineEnd - lineStart;
@ -985,9 +986,6 @@ public class StaticLayout extends Layout {
private static final double EXTRA_ROUNDING = 0.5;
private static final String ELLIPSIS_NORMAL = "\u2026"; // this is "..."
private static final String ELLIPSIS_TWO_DOTS = "\u2025"; // this is ".."
private static final int CHAR_FIRST_HIGH_SURROGATE = 0xD800;
private static final int CHAR_LAST_LOW_SURROGATE = 0xDFFF;