字体粗细 #185

This commit is contained in:
HapeLee
2025-11-02 12:23:19 +08:00
parent 45b454c4c1
commit b1701ad49f
4 changed files with 13 additions and 3 deletions
@@ -598,7 +598,7 @@ object ReadBookConfig {
var titleSize: Int = 0,
var titleTopSpacing: Int = 0,
var titleBottomSpacing: Int = 0,
var titleBold: Int = 500,
var titleBold: Int = 500,//是否粗体字 0:正常, 1:粗体, 2:细体
var titleLineSpacingExtra: Int = 4,
var titleSegType: Int = 0,//分段模式
var titleSegScaling: Float = 1.2f,//分段缩放,第二段与第一段的字体大小比例
@@ -140,7 +140,7 @@ class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_sele
}
val weightOptions = context?.resources?.getStringArray(R.array.text_font_weight)
val weightValues = listOf(2, 1, 0)
val weightValues = listOf(0, 1, 2)
val initialIndex = weightValues.indexOf(ReadBookConfig.textBold)
binding.textFontWeightConverter.text = weightOptions?.getOrNull(initialIndex) ?: "自定义"
@@ -53,7 +53,7 @@ class TipConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_tip_config
else -> { }
}
val weightOptions = context?.resources?.getStringArray(R.array.text_font_weight)
val weightValues = listOf(2, 1, 0)
val weightValues = listOf(0, 1, 2)
val initialIndex = weightValues.indexOf(ReadBookConfig.titleBold)
binding.textFontWeightConverter.text = weightOptions?.getOrNull(initialIndex) ?: "自定义"
binding.textFontWeightConverter.setOnClickListener {
@@ -930,6 +930,11 @@ object ChapterProvider {
else
normal
0 -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
Typeface.create(typeface, 300, false)
else
normal
in 100..900 -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
Typeface.create(typeface, ReadBookConfig.titleBold, false)
else
@@ -949,6 +954,11 @@ object ChapterProvider {
else
normal
0 -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
Typeface.create(typeface, 300, false)
else
normal
in 100..900 -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
Typeface.create(typeface, ReadBookConfig.textBold, false)
else