This commit is contained in:
Horis
2025-02-21 11:35:09 +08:00
parent 632d03fb63
commit 847abe37f4
@@ -242,7 +242,7 @@ class TextChapterLayout(
contentPaint,
contentPaintTextHeight,
contentPaintFontMetrics,
book.getImageStyle(),
imageStyle,
srcList = srcList
)
} else {
@@ -250,8 +250,9 @@ class TextChapterLayout(
isSetTypedImage = false
prepareNextPageIfNeed()
}
val matcher = AppPattern.imgPattern.matcher(content)
var start = 0
if (content.contains("<img")) {
val matcher = AppPattern.imgPattern.matcher(content)
while (matcher.find()) {
coroutineContext.ensureActive()
val text = content.substring(start, matcher.start())
@@ -262,7 +263,7 @@ class TextChapterLayout(
contentPaint,
contentPaintTextHeight,
contentPaintFontMetrics,
book.getImageStyle(),
imageStyle,
isFirstLine = start == 0
)
}
@@ -270,11 +271,12 @@ class TextChapterLayout(
book,
matcher.group(1)!!,
contentPaintTextHeight,
book.getImageStyle()
imageStyle
)
isSetTypedImage = true
start = matcher.end()
}
}
if (start < content.length) {
if (isSingleImageStyle && isSetTypedImage) {
isSetTypedImage = false
@@ -288,7 +290,7 @@ class TextChapterLayout(
contentPaint,
contentPaintTextHeight,
contentPaintFontMetrics,
book.getImageStyle(),
imageStyle,
isFirstLine = start == 0
)
}