From 3609f691f3456ac98f2b969040bdb38a47ca960a Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 23 Apr 2020 22:20:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/page/ChapterProvider.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt index 164d9fdc4..e0cee0b5c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt @@ -189,11 +189,11 @@ object ChapterProvider { val gapCount: Int = words.length - 1 val d = (visibleWidth - desiredWidth) / gapCount var x = startX - for ((i, char) in words.toStringArray().withIndex()) { - val cw = StaticLayout.getDesiredWidth(char, textPaint) - val x1 = if (i != words.lastIndex) (x + cw + d) else (x + cw) + words.toStringArray().forEachIndexed { index, s -> + val cw = StaticLayout.getDesiredWidth(s, textPaint) + val x1 = if (index != words.lastIndex) (x + cw + d) else (x + cw) textLine.addTextChar( - charData = char, + charData = s, start = paddingLeft + x, end = paddingLeft + x1 )