From fdd3e0345f4b746b88c1982e0ae9e2588a94f2c9 Mon Sep 17 00:00:00 2001 From: Horis <8674809+821938089@users.noreply.github.com> Date: Sun, 16 Mar 2025 19:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/read/page/provider/TextChapterLayout.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt index dfeff126b..009b2d232 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt @@ -803,14 +803,19 @@ class TextChapterLayout( var i = 0 while (i < length) { val clusterBaseIndex = i++ - widths.add(widthsArray[start + clusterBaseIndex]) + var extra = 0f while (i < length) { val c = text[i] - if ((widthsArray[start + i] > 0 && !c.isLowSurrogate()) || isZeroWidthChar(c)) { - break + val w = widthsArray[start + i] + if (w > 0 || isZeroWidthChar(c)) { + if (!c.isLowSurrogate()) { + break + } + extra = w } i++ } + widths.add(widthsArray[start + clusterBaseIndex] + extra) stringList.add(text.substring(clusterBaseIndex, i)) } return stringList to widths