mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -350,13 +350,13 @@ object ChapterProvider {
|
||||
srcList: LinkedList<String>? = null
|
||||
): Pair<Int, Float> {
|
||||
var absStartX = x
|
||||
val widthsArray = FloatArray(text.length)
|
||||
val layout = if (ReadBookConfig.useZhLayout) {
|
||||
ZhLayout(text, textPaint, visibleWidth)
|
||||
ZhLayout(text, textPaint, visibleWidth, widthsArray)
|
||||
} else {
|
||||
textPaint.getTextWidths(text, widthsArray)
|
||||
StaticLayout(text, textPaint, visibleWidth, Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true)
|
||||
}
|
||||
val widthsArray = FloatArray(text.length)
|
||||
textPaint.getTextWidths(text, widthsArray)
|
||||
val widthsList = widthsArray.asList()
|
||||
var durY = when {
|
||||
//标题y轴居中
|
||||
|
||||
@@ -13,7 +13,8 @@ import kotlin.math.max
|
||||
class ZhLayout(
|
||||
text: CharSequence,
|
||||
textPaint: TextPaint,
|
||||
width: Int
|
||||
width: Int,
|
||||
widthsArray: FloatArray
|
||||
) : Layout(text, textPaint, width, Alignment.ALIGN_NORMAL, 0f, 0f) {
|
||||
companion object {
|
||||
private val postPanc = hashSetOf(
|
||||
@@ -43,7 +44,6 @@ class ZhLayout(
|
||||
|
||||
init {
|
||||
var line = 0
|
||||
val widthsArray = FloatArray(text.length)
|
||||
curPaint.getTextWidths(text as String, widthsArray)
|
||||
val (words, widths) = ChapterProvider.getStringArrayAndTextWidths(
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user