Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d44fff7 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug #6661824 Hebrew Text can be clipped

- use the correct ellipsis char in both measurement and rendered string

Change-Id: Ia00285fc16da528f18702719026503b5d0610642
parent 68cefd20
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -1695,8 +1695,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) {
@@ -1710,7 +1716,7 @@ public abstract class Layout {
            char c;

            if (i == ellipsisStart) {
                c = '\u2026'; // ellipsis
                c = getEllipsisChar(method); // ellipsis
            } else {
                c = '\uFEFF'; // 0-width space
            }
@@ -1784,7 +1790,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);
            }
        }

@@ -1889,4 +1895,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 ".."
}
+2 −4
Original line number Diff line number Diff line
@@ -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;