Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdbabfc4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove unnecessary letter spaceing from the left and right of line" into main

parents 79132bde d27b2f20
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -16396,6 +16396,8 @@ package android.graphics {
    field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0
    field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0
    field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10
    field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10
    field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80
    field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80
    field @FlaggedApi("com.android.text.flags.inter_character_justification") public static final int TEXT_RUN_FLAG_LEFT_EDGE = 8192; // 0x2000
    field @FlaggedApi("com.android.text.flags.inter_character_justification") public static final int TEXT_RUN_FLAG_RIGHT_EDGE = 16384; // 0x4000
    field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8
    field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8
  }
  }
+22 −6
Original line number Original line Diff line number Diff line
@@ -671,9 +671,18 @@ public class MeasuredParagraph {
        if (mLtrWithoutBidi) {
        if (mLtrWithoutBidi) {
            // If the whole text is LTR direction, just apply whole region.
            // If the whole text is LTR direction, just apply whole region.
            if (builder == null) {
            if (builder == null) {
                // For the compatibility reasons, the letter spacing should not be dropped at the
                // left and right edge.
                int oldFlag = paint.getFlags();
                paint.setFlags(paint.getFlags()
                        | (Paint.TEXT_RUN_FLAG_LEFT_EDGE | Paint.TEXT_RUN_FLAG_RIGHT_EDGE));
                try {
                    mWholeWidth += paint.getTextRunAdvances(
                    mWholeWidth += paint.getTextRunAdvances(
                        mCopiedBuffer, start, end - start, start, end - start, false /* isRtl */,
                            mCopiedBuffer, start, end - start, start, end - start,
                        mWidths.getRawArray(), start);
                            false /* isRtl */, mWidths.getRawArray(), start);
                } finally {
                    paint.setFlags(oldFlag);
                }
            } else {
            } else {
                builder.appendStyleRun(paint, config, end - start, false /* isRtl */);
                builder.appendStyleRun(paint, config, end - start, false /* isRtl */);
            }
            }
@@ -690,9 +699,16 @@ public class MeasuredParagraph {
                    final boolean isRtl = (level & 0x1) != 0;
                    final boolean isRtl = (level & 0x1) != 0;
                    if (builder == null) {
                    if (builder == null) {
                        final int levelLength = levelEnd - levelStart;
                        final int levelLength = levelEnd - levelStart;
                        int oldFlag = paint.getFlags();
                        paint.setFlags(paint.getFlags()
                                | (Paint.TEXT_RUN_FLAG_LEFT_EDGE | Paint.TEXT_RUN_FLAG_RIGHT_EDGE));
                        try {
                            mWholeWidth += paint.getTextRunAdvances(
                            mWholeWidth += paint.getTextRunAdvances(
                                    mCopiedBuffer, levelStart, levelLength, levelStart, levelLength,
                                    mCopiedBuffer, levelStart, levelLength, levelStart, levelLength,
                                    isRtl, mWidths.getRawArray(), levelStart);
                                    isRtl, mWidths.getRawArray(), levelStart);
                        } finally {
                            paint.setFlags(oldFlag);
                        }
                    } else {
                    } else {
                        builder.appendStyleRun(paint, config, levelEnd - levelStart, isRtl);
                        builder.appendStyleRun(paint, config, levelEnd - levelStart, isRtl);
                    }
                    }
+153 −31

File changed.

Preview size limit exceeded, changes collapsed.

+224 −0

File added.

Preview size limit exceeded, changes collapsed.

+129 −40

File changed.

Preview size limit exceeded, changes collapsed.

Loading