Merge "Revert "Fix for ellipsized text that has two lines at maximum.""

This commit is contained in:
Gilles Debunne
2011-01-04 15:42:40 -08:00
committed by Android (Google) Code Review

View File

@@ -361,103 +361,101 @@ 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++;
}
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;
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 (ok != here) {
// Log.e("text", "output ok " + here + " to " +ok);
// Act like it fit even though it didn't.
while (ok < spanEnd && chs[ok - paraStart] == ' ') {
ok++;
}
fitwidth = w;
fit = j + 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);
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);
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;
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;
}
if (here < spanStart) {