From 7df8206eb67b15e3ade3b37a139c18ef21b2592c Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 8 Mar 2021 09:13:29 +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 --- .../app/ui/book/read/page/provider/ZhLayout.kt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ZhLayout.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ZhLayout.kt index c35c7f730..2e3f7d12a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ZhLayout.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ZhLayout.kt @@ -7,11 +7,10 @@ import android.text.TextPaint import io.legado.app.utils.toStringArray import kotlin.math.max -/* -* 针对中文的断行排版处理-by hoodie13 -* 因为StaticLayout对标点处理不符合国人习惯,继承Layout -* 接口封的不抽象,数组用的也琐碎,因目前语法不熟悉,后面完善。 -* */ +/** + * 针对中文的断行排版处理-by hoodie13 + * 因为StaticLayout对标点处理不符合国人习惯,继承Layout + * */ @Suppress("MemberVisibilityCanBePrivate", "unused") class ZhLayout( text: String, @@ -145,8 +144,7 @@ class ZhLayout( if (breakLine) { lineWidth[line] = lineW - offset lineW = offset - line++ - addLineArray(line) + addLineArray(++line) } /*已到最后一个字符*/ if ((words.lastIndex) == index) { @@ -155,15 +153,13 @@ class ZhLayout( lineStart[line + 1] = index + 1 lineWidth[line] = lineW - offset lineW = offset - line++ - addLineArray(line) + addLineArray(++line) } /*写满断行、段落末尾、且需要下移字符,这种特殊情况下要额外多一行*/ else if (breakCharCnt > 0) { lineStart[line + 1] = lineStart[line] + breakCharCnt lineWidth[line] = lineW - line++ - addLineArray(line) + addLineArray(++line) } } cwPre = cw