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

Commit 7c3255f1 authored by Raph Levien's avatar Raph Levien
Browse files

Fix bug 7054190 line breaks at inappropriate places

We were doing line breaks after punctuation as long as they weren't
surrounded by digits. This is a misinterpretation of the Unicode line
breaking algorithm. Punctuation (class IS) is not hugely different than
the default classes (NU and AL) - there are breaks after punctuation
that are allowed (for example, followed by an open parenthesis), but
we're not implementing the algorithm with anything near that level of
fidelity.

The long term fix is to really implement the algorithm. In the shorter
term, the easiest thing to do is to remove the special case altogether.

Change-Id: Ic4dc3216c2a4191fbb7cfa06e9dc038d1a56398c
parent 15525862
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -357,11 +357,6 @@ public class StaticLayout extends Layout {

                        // From the Unicode Line Breaking Algorithm (at least approximately)
                        boolean isLineBreak = isSpaceOrTab ||
                                // .,:; are class IS breakpoints, except when adjacent to digits
                                ((c == CHAR_DOT || c == CHAR_COMMA ||
                                c == CHAR_COLON || c == CHAR_SEMICOLON) &&
                                (j - 1 < here || !Character.isDigit(chs[j - 1 - paraStart])) &&
                                (j + 1 >= spanEnd || !Character.isDigit(chs[j + 1 - paraStart]))) ||
                                // / is class SY and - is class HY, except when followed by a digit
                                ((c == CHAR_SLASH || c == CHAR_HYPHEN) &&
                                (j + 1 >= spanEnd || !Character.isDigit(chs[j + 1 - paraStart]))) ||
@@ -959,10 +954,6 @@ public class StaticLayout extends Layout {
    private static final char CHAR_NEW_LINE = '\n';
    private static final char CHAR_TAB = '\t';
    private static final char CHAR_SPACE = ' ';
    private static final char CHAR_DOT = '.';
    private static final char CHAR_COMMA = ',';
    private static final char CHAR_COLON = ':';
    private static final char CHAR_SEMICOLON = ';';
    private static final char CHAR_SLASH = '/';
    private static final char CHAR_HYPHEN = '-';