|
|
@ -257,22 +257,24 @@ object ChapterProvider { |
|
|
|
if (lineIndex == 0 && layout.lineCount > 1) { |
|
|
|
if (lineIndex == 0 && layout.lineCount > 1) { |
|
|
|
//第一行 |
|
|
|
//第一行 |
|
|
|
var x = 0f |
|
|
|
var x = 0f |
|
|
|
val icw = StaticLayout.getDesiredWidth(bodyIndent, contentPaint) |
|
|
|
val icw = StaticLayout.getDesiredWidth(bodyIndent, contentPaint) / bodyIndent.length |
|
|
|
var x1 = x + icw |
|
|
|
for (i in 0..bodyIndent.lastIndex) { |
|
|
|
|
|
|
|
val x1 = x + icw |
|
|
|
val textChar = TextChar( |
|
|
|
val textChar = TextChar( |
|
|
|
charData = bodyIndent, |
|
|
|
charData = bodyIndent[i].toString(), |
|
|
|
leftBottomPosition = TextPoint(paddingLeft + x, textLine.lineBottom), |
|
|
|
leftBottomPosition = TextPoint(paddingLeft + x, textLine.lineBottom), |
|
|
|
rightTopPosition = TextPoint(paddingLeft + x1, textLine.lineTop) |
|
|
|
rightTopPosition = TextPoint(paddingLeft + x1, textLine.lineTop) |
|
|
|
) |
|
|
|
) |
|
|
|
textLine.textChars.add(textChar) |
|
|
|
textLine.textChars.add(textChar) |
|
|
|
x = x1 |
|
|
|
x = x1 |
|
|
|
|
|
|
|
} |
|
|
|
words = words.replaceFirst(bodyIndent, "") |
|
|
|
words = words.replaceFirst(bodyIndent, "") |
|
|
|
val gapCount: Int = words.length - 1 |
|
|
|
val gapCount: Int = words.length - 1 |
|
|
|
val d = (visibleWidth - desiredWidth) / gapCount |
|
|
|
val d = (visibleWidth - desiredWidth) / gapCount |
|
|
|
for (i in words.indices) { |
|
|
|
for (i in words.indices) { |
|
|
|
val char = words[i].toString() |
|
|
|
val char = words[i].toString() |
|
|
|
val cw = StaticLayout.getDesiredWidth(char, contentPaint) |
|
|
|
val cw = StaticLayout.getDesiredWidth(char, contentPaint) |
|
|
|
x1 = if (i != words.lastIndex) x + cw + d else x + cw |
|
|
|
val x1 = if (i != words.lastIndex) x + cw + d else x + cw |
|
|
|
val textChar1 = TextChar( |
|
|
|
val textChar1 = TextChar( |
|
|
|
charData = char, |
|
|
|
charData = char, |
|
|
|
leftBottomPosition = TextPoint(paddingLeft + x, textLine.lineBottom), |
|
|
|
leftBottomPosition = TextPoint(paddingLeft + x, textLine.lineBottom), |
|
|
|