Loading core/java/android/text/DynamicLayout.java +3 −3 Original line number Diff line number Diff line Loading @@ -281,9 +281,9 @@ extends Layout } reflowed.generate(text, where, where + after, getPaint(), getWidth(), getAlignment(), getTextDirectionHeuristic(), getSpacingMultiplier(), getSpacingAdd(), false, true, mEllipsizedWidth, mEllipsizeAt); getPaint(), getWidth(), getTextDirectionHeuristic(), getSpacingMultiplier(), getSpacingAdd(), false, true, mEllipsizedWidth, mEllipsizeAt); int n = reflowed.getLineCount(); // If the new layout has a blank line at the end, but it is not Loading core/java/android/text/StaticLayout.java +62 −82 Original line number Diff line number Diff line Loading @@ -137,9 +137,9 @@ public class StaticLayout extends Layout { mMeasured = MeasuredText.obtain(); generate(source, bufstart, bufend, paint, outerwidth, align, textDir, spacingmult, spacingadd, includepad, includepad, ellipsizedWidth, ellipsize); generate(source, bufstart, bufend, paint, outerwidth, textDir, spacingmult, spacingadd, includepad, includepad, ellipsizedWidth, ellipsize); mMeasured = MeasuredText.recycle(mMeasured); mFontMetricsInt = null; Loading @@ -157,10 +157,10 @@ public class StaticLayout extends Layout { /* package */ void generate(CharSequence source, int bufStart, int bufEnd, TextPaint paint, int outerWidth, Alignment align, TextDirectionHeuristic textDir, float spacingmult, float spacingadd, boolean includepad, boolean trackpad, float ellipsizedWidth, TextUtils.TruncateAt ellipsize) { TextDirectionHeuristic textDir, float spacingmult, float spacingadd, boolean includepad, boolean trackpad, float ellipsizedWidth, TextUtils.TruncateAt ellipsize) { mLineCount = 0; int v = 0; Loading Loading @@ -328,9 +328,7 @@ public class StaticLayout extends Layout { whichPaint = mWorkPaint; } float wid = bm.getWidth() * -whichPaint.ascent() / bm.getHeight(); float wid = bm.getWidth() * -whichPaint.ascent() / bm.getHeight(); w += wid; hasTabOrEmoji = true; Loading Loading @@ -399,66 +397,48 @@ public class StaticLayout extends Layout { } } else { final boolean moreChars = (j + 1 < spanEnd); int endPos; int above, below, top, bottom; float currentTextWidth; if (ok != here) { // Log.e("text", "output ok " + here + " to " +ok); // If it is a space that makes the length exceed width, cut here if (c == CHAR_SPACE) ok = j + 1; while (ok < spanEnd && chs[ok - paraStart] == CHAR_SPACE) { 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, paraStart, ellipsize, ellipsizedWidth, okWidth, paint, moreChars); here = ok; endPos = ok; above = okAscent; below = okDescent; top = okTop; bottom = okBottom; currentTextWidth = okWidth; } 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, paraStart, ellipsize, ellipsizedWidth, fitWidth, paint, moreChars); here = fit; endPos = fit; above = fitAscent; below = fitDescent; top = fitTop; bottom = fitBottom; currentTextWidth = fitWidth; } 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, paraStart, ellipsize, ellipsizedWidth, widths[here - paraStart], paint, moreChars); here = here + 1; endPos = here + 1; above = fm.ascent; below = fm.descent; top = fm.top; bottom = fm.bottom; currentTextWidth = widths[here - paraStart]; } v = out(source, here, endPos, above, below, top, bottom, v, spacingmult, spacingadd, chooseHt,chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, currentTextWidth, paint, moreChars); here = endPos; if (here < spanStart) { // didn't output all the text for this span // we've measured the raw widths, though, so Loading Loading @@ -501,10 +481,10 @@ public class StaticLayout extends Layout { v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, paraStart, chdirs, dir, easy, paraEnd == bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, w, paint, paraEnd != bufEnd); needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, w, paint, paraEnd != bufEnd); } paraStart = paraEnd; Loading @@ -525,10 +505,10 @@ public class StaticLayout extends Layout { v, spacingmult, spacingadd, null, null, fm, false, needMultiply, bufEnd, null, DEFAULT_DIR, true, true, includepad, trackpad, null, null, bufStart, ellipsize, ellipsizedWidth, 0, paint, false); needMultiply, null, DEFAULT_DIR, true, bufEnd, includepad, trackpad, null, null, bufStart, ellipsize, ellipsizedWidth, 0, paint, false); } } Loading Loading @@ -628,12 +608,12 @@ public class StaticLayout extends Layout { float spacingmult, float spacingadd, LineHeightSpan[] chooseHt, int[] chooseHtv, Paint.FontMetricsInt fm, boolean hasTabOrEmoji, boolean needMultiply, int pstart, byte[] chdirs, int dir, boolean easy, boolean last, boolean includePad, boolean trackPad, char[] chs, float[] widths, int widthStart, TextUtils.TruncateAt ellipsize, float ellipsisWidth, float textWidth, TextPaint paint, boolean moreChars) { boolean needMultiply, byte[] chdirs, int dir, boolean easy, int bufEnd, boolean includePad, boolean trackPad, char[] chs, float[] widths, int widthStart, TextUtils.TruncateAt ellipsize, float ellipsisWidth, float textWidth, TextPaint paint, boolean moreChars) { int j = mLineCount; int off = j * mColumns; int want = off + mColumns + TOP; Loading Loading @@ -683,7 +663,7 @@ public class StaticLayout extends Layout { above = top; } } if (last) { if (end == bufEnd) { if (trackPad) { mBottomPadding = bottom - below; } Loading Loading
core/java/android/text/DynamicLayout.java +3 −3 Original line number Diff line number Diff line Loading @@ -281,9 +281,9 @@ extends Layout } reflowed.generate(text, where, where + after, getPaint(), getWidth(), getAlignment(), getTextDirectionHeuristic(), getSpacingMultiplier(), getSpacingAdd(), false, true, mEllipsizedWidth, mEllipsizeAt); getPaint(), getWidth(), getTextDirectionHeuristic(), getSpacingMultiplier(), getSpacingAdd(), false, true, mEllipsizedWidth, mEllipsizeAt); int n = reflowed.getLineCount(); // If the new layout has a blank line at the end, but it is not Loading
core/java/android/text/StaticLayout.java +62 −82 Original line number Diff line number Diff line Loading @@ -137,9 +137,9 @@ public class StaticLayout extends Layout { mMeasured = MeasuredText.obtain(); generate(source, bufstart, bufend, paint, outerwidth, align, textDir, spacingmult, spacingadd, includepad, includepad, ellipsizedWidth, ellipsize); generate(source, bufstart, bufend, paint, outerwidth, textDir, spacingmult, spacingadd, includepad, includepad, ellipsizedWidth, ellipsize); mMeasured = MeasuredText.recycle(mMeasured); mFontMetricsInt = null; Loading @@ -157,10 +157,10 @@ public class StaticLayout extends Layout { /* package */ void generate(CharSequence source, int bufStart, int bufEnd, TextPaint paint, int outerWidth, Alignment align, TextDirectionHeuristic textDir, float spacingmult, float spacingadd, boolean includepad, boolean trackpad, float ellipsizedWidth, TextUtils.TruncateAt ellipsize) { TextDirectionHeuristic textDir, float spacingmult, float spacingadd, boolean includepad, boolean trackpad, float ellipsizedWidth, TextUtils.TruncateAt ellipsize) { mLineCount = 0; int v = 0; Loading Loading @@ -328,9 +328,7 @@ public class StaticLayout extends Layout { whichPaint = mWorkPaint; } float wid = bm.getWidth() * -whichPaint.ascent() / bm.getHeight(); float wid = bm.getWidth() * -whichPaint.ascent() / bm.getHeight(); w += wid; hasTabOrEmoji = true; Loading Loading @@ -399,66 +397,48 @@ public class StaticLayout extends Layout { } } else { final boolean moreChars = (j + 1 < spanEnd); int endPos; int above, below, top, bottom; float currentTextWidth; if (ok != here) { // Log.e("text", "output ok " + here + " to " +ok); // If it is a space that makes the length exceed width, cut here if (c == CHAR_SPACE) ok = j + 1; while (ok < spanEnd && chs[ok - paraStart] == CHAR_SPACE) { 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, paraStart, ellipsize, ellipsizedWidth, okWidth, paint, moreChars); here = ok; endPos = ok; above = okAscent; below = okDescent; top = okTop; bottom = okBottom; currentTextWidth = okWidth; } 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, paraStart, ellipsize, ellipsizedWidth, fitWidth, paint, moreChars); here = fit; endPos = fit; above = fitAscent; below = fitDescent; top = fitTop; bottom = fitBottom; currentTextWidth = fitWidth; } 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, paraStart, ellipsize, ellipsizedWidth, widths[here - paraStart], paint, moreChars); here = here + 1; endPos = here + 1; above = fm.ascent; below = fm.descent; top = fm.top; bottom = fm.bottom; currentTextWidth = widths[here - paraStart]; } v = out(source, here, endPos, above, below, top, bottom, v, spacingmult, spacingadd, chooseHt,chooseHtv, fm, hasTabOrEmoji, needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, currentTextWidth, paint, moreChars); here = endPos; if (here < spanStart) { // didn't output all the text for this span // we've measured the raw widths, though, so Loading Loading @@ -501,10 +481,10 @@ public class StaticLayout extends Layout { v, spacingmult, spacingadd, chooseHt, chooseHtv, fm, hasTabOrEmoji, needMultiply, paraStart, chdirs, dir, easy, paraEnd == bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, w, paint, paraEnd != bufEnd); needMultiply, chdirs, dir, easy, bufEnd, includepad, trackpad, chs, widths, paraStart, ellipsize, ellipsizedWidth, w, paint, paraEnd != bufEnd); } paraStart = paraEnd; Loading @@ -525,10 +505,10 @@ public class StaticLayout extends Layout { v, spacingmult, spacingadd, null, null, fm, false, needMultiply, bufEnd, null, DEFAULT_DIR, true, true, includepad, trackpad, null, null, bufStart, ellipsize, ellipsizedWidth, 0, paint, false); needMultiply, null, DEFAULT_DIR, true, bufEnd, includepad, trackpad, null, null, bufStart, ellipsize, ellipsizedWidth, 0, paint, false); } } Loading Loading @@ -628,12 +608,12 @@ public class StaticLayout extends Layout { float spacingmult, float spacingadd, LineHeightSpan[] chooseHt, int[] chooseHtv, Paint.FontMetricsInt fm, boolean hasTabOrEmoji, boolean needMultiply, int pstart, byte[] chdirs, int dir, boolean easy, boolean last, boolean includePad, boolean trackPad, char[] chs, float[] widths, int widthStart, TextUtils.TruncateAt ellipsize, float ellipsisWidth, float textWidth, TextPaint paint, boolean moreChars) { boolean needMultiply, byte[] chdirs, int dir, boolean easy, int bufEnd, boolean includePad, boolean trackPad, char[] chs, float[] widths, int widthStart, TextUtils.TruncateAt ellipsize, float ellipsisWidth, float textWidth, TextPaint paint, boolean moreChars) { int j = mLineCount; int off = j * mColumns; int want = off + mColumns + TOP; Loading Loading @@ -683,7 +663,7 @@ public class StaticLayout extends Layout { above = top; } } if (last) { if (end == bufEnd) { if (trackPad) { mBottomPadding = bottom - below; } Loading