summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anish Athalye <aathalye@google.com> 2014-07-28 19:10:19 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-07-28 19:10:19 +0000
commitc51a6e45e857ee42d122e898590eb815e568564d (patch)
treebce5db60ca677799b771523ff8cd902e9b2e84e8
parenta9c5257a15f2efb5c017d2ecadb5a7360230bfee (diff)
parenta28e4764994283c3595dd41f12e425cf7dc0d985 (diff)
am a28e4764: DO NOT MERGE Fix line breaking for clusters in narrow views
* commit 'a28e4764994283c3595dd41f12e425cf7dc0d985': DO NOT MERGE Fix line breaking for clusters in narrow views
-rw-r--r--core/java/android/text/StaticLayout.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java
index 814326c3ba3f..457e04f6e562 100644
--- a/core/java/android/text/StaticLayout.java
+++ b/core/java/android/text/StaticLayout.java
@@ -379,7 +379,7 @@ public class StaticLayout extends Layout {
okBottom = fitBottom;
}
} else {
- final boolean moreChars = (j + 1 < spanEnd);
+ final boolean moreChars;
int endPos;
int above, below, top, bottom;
float currentTextWidth;
@@ -391,6 +391,7 @@ public class StaticLayout extends Layout {
top = okTop;
bottom = okBottom;
currentTextWidth = okWidth;
+ moreChars = (j + 1 < spanEnd);
} else if (fit != here) {
endPos = fit;
above = fitAscent;
@@ -398,13 +399,21 @@ public class StaticLayout extends Layout {
top = fitTop;
bottom = fitBottom;
currentTextWidth = fitWidth;
+ moreChars = (j + 1 < spanEnd);
} else {
+ // must make progress, so take next character
endPos = here + 1;
- above = fm.ascent;
- below = fm.descent;
- top = fm.top;
- bottom = fm.bottom;
+ // but to deal properly with clusters
+ // take all zero width characters following that
+ while (endPos < spanEnd && widths[endPos - paraStart] == 0) {
+ endPos++;
+ }
+ above = fmAscent;
+ below = fmDescent;
+ top = fmTop;
+ bottom = fmBottom;
currentTextWidth = widths[here - paraStart];
+ moreChars = (endPos < spanEnd);
}
v = out(source, here, endPos,