summaryrefslogtreecommitdiff
path: root/core/java/android/text/StaticLayout.java
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2012-08-24 13:48:37 -0700
committerRaph Levien <raph@google.com>2012-08-24 13:48:37 -0700
commit7c3255f14f83afb00da32aede43664e16da51f53 (patch)
tree4aa32dc594e557d9e0e1dc349619dd96a4110eff /core/java/android/text/StaticLayout.java
parent1552586283f329253edc4786a6cf40c5bb69ea36 (diff)
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
Diffstat (limited to 'core/java/android/text/StaticLayout.java')
-rw-r--r--core/java/android/text/StaticLayout.java9
1 files changed, 0 insertions, 9 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java
index ac3dee49852d..90512853ca45 100644
--- a/core/java/android/text/StaticLayout.java
+++ b/core/java/android/text/StaticLayout.java
@@ -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 = '-';