diff options
author | Gilles Debunne <debunne@google.com> | 2010-12-23 11:20:48 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-23 11:20:48 -0800 |
commit | 9a99244a95f9445a6dbd25d47532c7c947a26278 (patch) | |
tree | 65712c9b82121530b62d84279e4b885688dbe8ba /core | |
parent | 68b9f6f90a8e659a3e40a010f8ad46382f0deeb8 (diff) | |
parent | 32ea4ffdca0f4706e447d0a275f259fe121b9e6a (diff) | |
download | frameworks_base-9a99244a95f9445a6dbd25d47532c7c947a26278.zip frameworks_base-9a99244a95f9445a6dbd25d47532c7c947a26278.tar.gz frameworks_base-9a99244a95f9445a6dbd25d47532c7c947a26278.tar.bz2 |
Merge "Fix for ellipsized text that has two lines at maximum."
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/text/StaticLayout.java | 182 |
1 files changed, 92 insertions, 90 deletions
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 3dd1ecd..d8d6320 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -361,101 +361,103 @@ public class StaticLayout extends Layout if (fitbottom > okbottom) okbottom = fitbottom; } - } else if (breakOnlyAtSpaces) { - if (ok != here) { - // Log.e("text", "output ok " + here + " to " +ok); + } else { + if (breakOnlyAtSpaces) { + if (ok != here) { + // Log.e("text", "output ok " + here + " to " +ok); - while (ok < spanEnd && chs[ok - paraStart] == ' ') { - ok++; - } + while (ok < spanEnd && chs[ok - paraStart] == ' ') { + ok++; + } - v = out(source, - here, ok, - okascent, okdescent, oktop, okbottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - ok == bufend, includepad, trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, okwidth, - paint); - - here = ok; + v = out(source, + here, ok, + okascent, okdescent, oktop, okbottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + ok == bufend, includepad, trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, okwidth, + paint); + + here = ok; + } else { + // Act like it fit even though it didn't. + + fitwidth = w; + fit = j + 1; + + if (fmtop < fittop) + fittop = fmtop; + if (fmascent < fitascent) + fitascent = fmascent; + if (fmdescent > fitdescent) + fitdescent = fmdescent; + if (fmbottom > fitbottom) + fitbottom = fmbottom; + } } else { - // Act like it fit even though it didn't. - - fitwidth = w; - fit = j + 1; - - if (fmtop < fittop) - fittop = fmtop; - if (fmascent < fitascent) - fitascent = fmascent; - if (fmdescent > fitdescent) - fitdescent = fmdescent; - if (fmbottom > fitbottom) - fitbottom = fmbottom; - } - } else { - if (ok != here) { - // Log.e("text", "output ok " + here + " to " +ok); + if (ok != here) { + // Log.e("text", "output ok " + here + " to " +ok); - while (ok < spanEnd && chs[ok - paraStart] == ' ') { - ok++; - } + while (ok < spanEnd && chs[ok - paraStart] == ' ') { + ok++; + } - v = out(source, - here, ok, - okascent, okdescent, oktop, okbottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - ok == bufend, includepad, trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, okwidth, - paint); - - here = ok; - } else if (fit != here) { - // Log.e("text", "output fit " + here + " to " +fit); - v = out(source, - here, fit, - fitascent, fitdescent, - fittop, fitbottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - fit == bufend, includepad, trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, fitwidth, - paint); - - here = fit; - } else { - // Log.e("text", "output one " + here + " to " +(here + 1)); - // XXX not sure why the existing fm wasn't ok. - // measureText(paint, mWorkPaint, - // source, here, here + 1, fm, tab, - // null); - - v = out(source, - here, here+1, - fm.ascent, fm.descent, - fm.top, fm.bottom, - v, - spacingmult, spacingadd, chooseht, - choosehtv, fm, hasTabOrEmoji, - needMultiply, paraStart, chdirs, dir, easy, - here + 1 == bufend, includepad, - trackpad, - chs, widths, here - paraStart, - where, ellipsizedWidth, - widths[here - paraStart], paint); - - here = here + 1; + v = out(source, + here, ok, + okascent, okdescent, oktop, okbottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + ok == bufend, includepad, trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, okwidth, + paint); + + here = ok; + } else if (fit != here) { + // Log.e("text", "output fit " + here + " to " +fit); + v = out(source, + here, fit, + fitascent, fitdescent, + fittop, fitbottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + fit == bufend, includepad, trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, fitwidth, + paint); + + here = fit; + } else { + // Log.e("text", "output one " + here + " to " +(here + 1)); + // XXX not sure why the existing fm wasn't ok. + // measureText(paint, mWorkPaint, + // source, here, here + 1, fm, tab, + // null); + + v = out(source, + here, here+1, + fm.ascent, fm.descent, + fm.top, fm.bottom, + v, + spacingmult, spacingadd, chooseht, + choosehtv, fm, hasTabOrEmoji, + needMultiply, paraStart, chdirs, dir, easy, + here + 1 == bufend, includepad, + trackpad, + chs, widths, here - paraStart, + where, ellipsizedWidth, + widths[here - paraStart], paint); + + here = here + 1; + } } if (here < spanStart) { |