优化
This commit is contained in:
@@ -463,10 +463,10 @@ class TextChapterLayout(
|
|||||||
val lineText = text.substring(lineStart, lineEnd)
|
val lineText = text.substring(lineStart, lineEnd)
|
||||||
val (words, widths) = measureTextSplit(lineText, textPaint)
|
val (words, widths) = measureTextSplit(lineText, textPaint)
|
||||||
val desiredWidth = widths.fastSum()
|
val desiredWidth = widths.fastSum()
|
||||||
|
textLine.text = lineText
|
||||||
when {
|
when {
|
||||||
lineIndex == 0 && layout.lineCount > 1 && !isTitle -> {
|
lineIndex == 0 && layout.lineCount > 1 && !isTitle -> {
|
||||||
//第一行 非标题
|
//第一行 非标题
|
||||||
textLine.text = lineText
|
|
||||||
addCharsToLineFirst(
|
addCharsToLineFirst(
|
||||||
book, absStartX, textLine, words, textPaint,
|
book, absStartX, textLine, words, textPaint,
|
||||||
desiredWidth, widths, srcList
|
desiredWidth, widths, srcList
|
||||||
@@ -475,7 +475,6 @@ class TextChapterLayout(
|
|||||||
|
|
||||||
lineIndex == layout.lineCount - 1 -> {
|
lineIndex == layout.lineCount - 1 -> {
|
||||||
//最后一行
|
//最后一行
|
||||||
textLine.text = lineText
|
|
||||||
//标题x轴居中
|
//标题x轴居中
|
||||||
val startX = if (
|
val startX = if (
|
||||||
isTitle &&
|
isTitle &&
|
||||||
@@ -504,7 +503,6 @@ class TextChapterLayout(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
//中间行
|
//中间行
|
||||||
textLine.text = lineText
|
|
||||||
addCharsToLineMiddle(
|
addCharsToLineMiddle(
|
||||||
book, absStartX, textLine, words, textPaint,
|
book, absStartX, textLine, words, textPaint,
|
||||||
desiredWidth, 0f, widths, srcList
|
desiredWidth, 0f, widths, srcList
|
||||||
|
|||||||
Reference in New Issue
Block a user