From 8c2c842c58593ee8b759f2dc88102b23880eefdc Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 22 Nov 2020 22:30:25 +0800 Subject: [PATCH 1/2] =?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/src/main/java/io/legado/app/help/JsExtensions.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 36810d457..10e681f6c 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -275,12 +275,11 @@ interface JsExtensions { end: Int ): String { if (font1 == null || font2 == null) return text - val startChar = start.toChar() - val endChar = end.toChar() val contentArray = text.toCharArray() contentArray.forEachIndexed { index, s -> - if (s in startChar until endChar) { - val code = font2.GetCodeByGlyf(font1.GetGlyfByCode(s.toInt())) + val oldCode = s.toInt() + if (oldCode in startChar until endChar) { + val code = font2.GetCodeByGlyf(font1.GetGlyfByCode(oldCode)) contentArray[index] = code.toChar() } } From 350c4826bf82220edb7bf5ba46ee21b747ed9452 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 22 Nov 2020 22:30:48 +0800 Subject: [PATCH 2/2] =?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/src/main/java/io/legado/app/help/JsExtensions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 10e681f6c..6c2d82bbd 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -278,7 +278,7 @@ interface JsExtensions { val contentArray = text.toCharArray() contentArray.forEachIndexed { index, s -> val oldCode = s.toInt() - if (oldCode in startChar until endChar) { + if (oldCode in start until end) { val code = font2.GetCodeByGlyf(font1.GetGlyfByCode(oldCode)) contentArray[index] = code.toChar() }