[Bug] Remove density scaling logic in header config
This commit is contained in:
commit
9f1ac87b71
@ -114,7 +114,7 @@ public class SpannableTheme {
|
|||||||
|
|
||||||
// taken from html spec (most browsers render headings like that)
|
// taken from html spec (most browsers render headings like that)
|
||||||
// is not exposed via protected modifier in order to disallow modification
|
// is not exposed via protected modifier in order to disallow modification
|
||||||
private static final float[] HEADING_SIZES = {
|
private static final float[] HEADING_SCALES = {
|
||||||
2.F, 1.5F, 1.17F, 1.F, .83F, .67F,
|
2.F, 1.5F, 1.17F, 1.F, .83F, .67F,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -347,8 +347,8 @@ public class SpannableTheme {
|
|||||||
|
|
||||||
paint.setFakeBoldText(true);
|
paint.setFakeBoldText(true);
|
||||||
|
|
||||||
final float textSize = headingTypeConfig.getTextSize() > 0 ?
|
final float textSize = headingTypeConfig.getTextScale() > 0 ?
|
||||||
headingTypeConfig.getTextSize() : HEADING_SIZES[level - 1];
|
headingTypeConfig.getTextScale() : HEADING_SCALES[level - 1];
|
||||||
paint.setTextSize(paint.getTextSize() * textSize);
|
paint.setTextSize(paint.getTextSize() * textSize);
|
||||||
|
|
||||||
final int textColor = headingTypeConfig.getTextColor();
|
final int textColor = headingTypeConfig.getTextColor();
|
||||||
|
@ -43,22 +43,19 @@ class HeadingConfig @JvmOverloads constructor(
|
|||||||
*
|
*
|
||||||
* Can set text size, text color and font (typeface)
|
* Can set text size, text color and font (typeface)
|
||||||
*
|
*
|
||||||
* @property textSize Text size for heading
|
* @property textScale Text scale for heading
|
||||||
* @property textColor Text color for heading
|
* @property textColor Text color for heading
|
||||||
* @property typeface Text size for heading
|
* @property typeface Typeface for heading
|
||||||
*/
|
*/
|
||||||
class HeadingTypeConfig @JvmOverloads constructor(
|
class HeadingTypeConfig @JvmOverloads constructor(
|
||||||
//Standard sizes available at #SpannableTheme.java:HEADING_SIZES
|
//Standard sizes available at #SpannableTheme.java:HEADING_SIZES
|
||||||
textSize: Float = -1F,
|
val textScale: Float = -1F,
|
||||||
|
|
||||||
@ColorInt val textColor: Int = -1,
|
@ColorInt val textColor: Int = -1,
|
||||||
|
|
||||||
val typeface: Typeface? = null
|
val typeface: Typeface? = null
|
||||||
) {
|
) {
|
||||||
internal var densityFactor: Float = -1F
|
internal var densityFactor: Float = -1F
|
||||||
|
|
||||||
val textSize: Float = textSize
|
|
||||||
get() = field * densityFactor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user