[Bug] Remove density scaling logic in header config

This commit is contained in:
michel.onwordi 2018-01-09 17:52:23 +01:00
commit 9f1ac87b71
2 changed files with 6 additions and 9 deletions

View File

@ -114,7 +114,7 @@ public class SpannableTheme {
// taken from html spec (most browsers render headings like that)
// 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,
};
@ -347,8 +347,8 @@ public class SpannableTheme {
paint.setFakeBoldText(true);
final float textSize = headingTypeConfig.getTextSize() > 0 ?
headingTypeConfig.getTextSize() : HEADING_SIZES[level - 1];
final float textSize = headingTypeConfig.getTextScale() > 0 ?
headingTypeConfig.getTextScale() : HEADING_SCALES[level - 1];
paint.setTextSize(paint.getTextSize() * textSize);
final int textColor = headingTypeConfig.getTextColor();

View File

@ -43,22 +43,19 @@ class HeadingConfig @JvmOverloads constructor(
*
* 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 typeface Text size for heading
* @property typeface Typeface for heading
*/
class HeadingTypeConfig @JvmOverloads constructor(
//Standard sizes available at #SpannableTheme.java:HEADING_SIZES
textSize: Float = -1F,
val textScale: Float = -1F,
@ColorInt val textColor: Int = -1,
val typeface: Typeface? = null
) {
internal var densityFactor: Float = -1F
val textSize: Float = textSize
get() = field * densityFactor
}
/**