diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index 3fba231a4..9c696b89d 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -165,9 +165,12 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at lineBottom: Float, ) { ReadBook.book?.let { book -> - val rectF = RectF(textChar.start, lineTop, textChar.end, lineBottom) ImageProvider.getImage(book, textPage.chapterIndex, textChar.charData, true) ?.let { + /*以宽度为基准保持图片的原始比例叠加,当div为负数时,允许高度比字符更高*/ + val h = (textChar.end - textChar.start) / it.width * it.height + val div = (lineBottom - lineTop - h) / 2 + val rectF = RectF(textChar.start, lineTop + div, textChar.end, lineBottom - div) canvas.drawBitmap(it, null, rectF, null) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index 54fec4b6e..786050eab 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -69,7 +69,8 @@ object ChapterProvider { @JvmStatic lateinit var contentPaint: TextPaint - private const val srcReplaceChar = "🖼" + /*🖼字符长度是2,做自定义排版等一些处理时会异常,用卍取代*/ + private const val srcReplaceChar = "卍" init { upStyle()