|
|
|
@ -69,7 +69,8 @@ object ChapterProvider { |
|
|
|
|
private set |
|
|
|
|
|
|
|
|
|
@JvmStatic |
|
|
|
|
private var lineSpacingExtra = 0 |
|
|
|
|
var lineSpacingExtra = 0f |
|
|
|
|
private set |
|
|
|
|
|
|
|
|
|
@JvmStatic |
|
|
|
|
private var paragraphSpacing = 0 |
|
|
|
@ -351,7 +352,7 @@ object ChapterProvider { |
|
|
|
|
if (isLastLine) stringBuilder.append("\n") |
|
|
|
|
textPages.last().textLines.add(textLine) |
|
|
|
|
textLine.upTopBottom(durY, textPaint) |
|
|
|
|
durY += textPaint.textHeight * lineSpacingExtra / 10f |
|
|
|
|
durY += textPaint.textHeight * lineSpacingExtra |
|
|
|
|
textPages.last().height = durY |
|
|
|
|
} |
|
|
|
|
if (isTitle) durY += titleBottomSpacing |
|
|
|
@ -500,12 +501,12 @@ object ChapterProvider { |
|
|
|
|
*/ |
|
|
|
|
fun upStyle() { |
|
|
|
|
typeface = getTypeface(ReadBookConfig.textFont) |
|
|
|
|
getPaint(typeface).let { |
|
|
|
|
getPaints(typeface).let { |
|
|
|
|
titlePaint = it.first |
|
|
|
|
contentPaint = it.second |
|
|
|
|
} |
|
|
|
|
//间距 |
|
|
|
|
lineSpacingExtra = ReadBookConfig.lineSpacingExtra |
|
|
|
|
lineSpacingExtra = ReadBookConfig.lineSpacingExtra / 10f |
|
|
|
|
paragraphSpacing = ReadBookConfig.paragraphSpacing |
|
|
|
|
titleTopSpacing = ReadBookConfig.titleTopSpacing.dp |
|
|
|
|
titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp |
|
|
|
@ -538,7 +539,7 @@ object ChapterProvider { |
|
|
|
|
} ?: Typeface.DEFAULT |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun getPaint(typeface: Typeface): Pair<TextPaint, TextPaint> { |
|
|
|
|
private fun getPaints(typeface: Typeface): Pair<TextPaint, TextPaint> { |
|
|
|
|
// 字体统一处理 |
|
|
|
|
val bold = Typeface.create(typeface, Typeface.BOLD) |
|
|
|
|
val normal = Typeface.create(typeface, Typeface.NORMAL) |
|
|
|
|