This commit is contained in:
Horis 2024-02-21 09:53:48 +08:00
parent 7ecff06671
commit abdc23967c

View File

@ -782,8 +782,11 @@ object ChapterProvider {
paragraphSpacing = ReadBookConfig.paragraphSpacing
titleTopSpacing = ReadBookConfig.titleTopSpacing.dpToPx()
titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dpToPx()
val bodyIndent = ReadBookConfig.paragraphIndent
indentCharWidth = StaticLayout.getDesiredWidth(bodyIndent, contentPaint) / bodyIndent.length
var bodyIndent = ReadBookConfig.paragraphIndent
val indentLength = bodyIndent.length
// 有些字体的中文空格宽度不对
bodyIndent = "".repeat(indentLength)
indentCharWidth = StaticLayout.getDesiredWidth(bodyIndent, contentPaint) / indentLength
titlePaintTextHeight = titlePaint.textHeight
contentPaintTextHeight = contentPaint.textHeight
titlePaintFontMetrics = titlePaint.fontMetrics