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

Commit d8054d99 authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Automerger Merge Worker
Browse files

Merge "Store string of most recent shaped text for debugging" into tm-qpr-dev...

Merge "Store string of most recent shaped text for debugging" into tm-qpr-dev am: fee20da8 am: 7828ff5c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20941593



Change-Id: If61221e0ed8f25add9d8f8dcd16db9690b8a455a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1df56964 7828ff5c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -122,6 +122,9 @@ class TextInterpolator(
            shapeText(value)
        }

    var shapedText: String = ""
        private set

    init {
        // shapeText needs to be called after all members are initialized.
        shapeText(layout)
@@ -484,10 +487,12 @@ class TextInterpolator(
        layout: Layout,
        paint: TextPaint
    ): List<List<PositionedGlyphs>> {
        var text = StringBuilder()
        val out = mutableListOf<List<PositionedGlyphs>>()
        for (lineNo in 0 until layout.lineCount) { // Shape all lines.
            val lineStart = layout.getLineStart(lineNo)
            var count = layout.getLineEnd(lineNo) - lineStart
            val lineEnd = layout.getLineEnd(lineNo)
            var count = lineEnd - lineStart
            // Do not render the last character in the line if it's a newline and unprintable
            val last = lineStart + count - 1
            if (last > lineStart && last < layout.text.length && layout.text[last] == '\n') {
@@ -500,7 +505,13 @@ class TextInterpolator(
                runs.add(glyphs)
            }
            out.add(runs)

            if (lineNo > 0) {
                text.append("\n")
            }
            text.append(layout.text.substring(lineStart, lineEnd))
        }
        shapedText = text.toString()
        return out
    }
}