Merge pull request #501 from gedoor/master

修复Int转Char的bug
pull/502/head
Antecer 4 years ago committed by GitHub
commit b305e3cafb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      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 start until end) {
val code = font2.GetCodeByGlyf(font1.GetGlyfByCode(oldCode))
contentArray[index] = code.toChar()
}
}

Loading…
Cancel
Save