pull/1835/head
kunfei 3 years ago
parent 2cd4ed61c7
commit 258585666b
  1. 23
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@ -252,12 +252,7 @@ object ChapterProvider {
Pair(0f, width.toFloat()) Pair(0f, width.toFloat())
} }
textLine.textChars.add( textLine.textChars.add(
TextChar( TextChar(charData = src, start = x + start, end = x + end, isImage = true)
charData = src,
start = x + start,
end = x + end,
isImage = true
)
) )
textPages.last().textLines.add(textLine) textPages.last().textLines.add(textLine)
} }
@ -349,10 +344,14 @@ object ChapterProvider {
textLine.text = words textLine.text = words
textLine.isParagraphEnd = true textLine.isParagraphEnd = true
//标题x轴居中 //标题x轴居中
val startX = val startX = if (isTitle && ReadBookConfig.titleMode == 1
if (isTitle && ReadBookConfig.titleMode == 1 || isTitleWithNoContent || isVolumeTitle) || isTitleWithNoContent
|| isVolumeTitle
) {
(visibleWidth - layout.getLineWidth(lineIndex)) / 2 (visibleWidth - layout.getLineWidth(lineIndex)) / 2
else 0f } else {
0f
}
addCharsToLineLast( addCharsToLineLast(
book, absStartX, textLine, words.toStringArray(), book, absStartX, textLine, words.toStringArray(),
textPaint, startX, srcList textPaint, startX, srcList
@ -402,11 +401,7 @@ object ChapterProvider {
bodyIndent.toStringArray().forEach { char -> bodyIndent.toStringArray().forEach { char ->
val x1 = x + icw val x1 = x + icw
textLine.textChars.add( textLine.textChars.add(
TextChar( TextChar(charData = char, start = absStartX + x, end = absStartX + x1)
charData = char,
start = absStartX + x,
end = absStartX + x1
)
) )
x = x1 x = x1
} }

Loading…
Cancel
Save