@@ -44,6 +44,7 @@ import android.text.TextWatcher
4444import android.text.style.SuggestionSpan
4545import android.util.AttributeSet
4646import android.util.DisplayMetrics
47+ import android.util.TypedValue
4748import android.view.KeyEvent
4849import android.view.LayoutInflater
4950import android.view.MotionEvent
@@ -479,6 +480,8 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
479480 styles.getBoolean(R .styleable.AztecText_taskListStrikethroughChecked , false ),
480481 styles.getColor(R .styleable.AztecText_taskListCheckedTextColor , 0 ))
481482
483+ val textSizeModifier = styles.getDimensionPixelSize(R .styleable.AztecText_textSizeModifier , 0 )
484+
482485 blockFormatter = BlockFormatter (editor = this ,
483486 listStyle = listStyle,
484487 listItemStyle = listItemStyle,
@@ -495,26 +498,32 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
495498 headerStyle = BlockFormatter .HeaderStyles (verticalHeadingMargin, mapOf (
496499 AztecHeadingSpan .Heading .H1 to BlockFormatter .HeaderStyles .HeadingStyle (
497500 styles.getDimensionPixelSize(R .styleable.AztecText_headingOneFontSize , 0 ),
501+ textSizeModifier,
498502 styles.getColor(R .styleable.AztecText_headingOneFontColor , 0 )
499503 ),
500504 AztecHeadingSpan .Heading .H2 to BlockFormatter .HeaderStyles .HeadingStyle (
501505 styles.getDimensionPixelSize(R .styleable.AztecText_headingTwoFontSize , 0 ),
506+ textSizeModifier,
502507 styles.getColor(R .styleable.AztecText_headingTwoFontColor , 0 )
503508 ),
504509 AztecHeadingSpan .Heading .H3 to BlockFormatter .HeaderStyles .HeadingStyle (
505510 styles.getDimensionPixelSize(R .styleable.AztecText_headingThreeFontSize , 0 ),
511+ textSizeModifier,
506512 styles.getColor(R .styleable.AztecText_headingThreeFontColor , 0 )
507513 ),
508514 AztecHeadingSpan .Heading .H4 to BlockFormatter .HeaderStyles .HeadingStyle (
509515 styles.getDimensionPixelSize(R .styleable.AztecText_headingFourFontSize , 0 ),
516+ textSizeModifier,
510517 styles.getColor(R .styleable.AztecText_headingFourFontColor , 0 )
511518 ),
512519 AztecHeadingSpan .Heading .H5 to BlockFormatter .HeaderStyles .HeadingStyle (
513520 styles.getDimensionPixelSize(R .styleable.AztecText_headingFiveFontSize , 0 ),
521+ textSizeModifier,
514522 styles.getColor(R .styleable.AztecText_headingFiveFontColor , 0 )
515523 ),
516524 AztecHeadingSpan .Heading .H6 to BlockFormatter .HeaderStyles .HeadingStyle (
517525 styles.getDimensionPixelSize(R .styleable.AztecText_headingSixFontSize , 0 ),
526+ textSizeModifier,
518527 styles.getColor(R .styleable.AztecText_headingSixFontColor , 0 )
519528 )
520529 )),
@@ -528,7 +537,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
528537 styles.getColor(R .styleable.AztecText_preformatBorderColor , 0 ),
529538 styles.getDimensionPixelSize(R .styleable.AztecText_preformatBorderRadius , 0 ),
530539 styles.getDimensionPixelSize(R .styleable.AztecText_preformatBorderThickness , 0 ),
531- styles.getDimensionPixelSize(R .styleable.AztecText_preformatTextSize , textSize.toInt())
540+ styles.getDimensionPixelSize(R .styleable.AztecText_preformatTextSize , textSize.toInt()) + textSizeModifier
532541 ),
533542 alignmentRendering = alignmentRendering,
534543 exclusiveBlockStyles = BlockFormatter .ExclusiveBlockStyles (styles.getBoolean(R .styleable.AztecText_exclusiveBlocks , false ), verticalParagraphPadding),
@@ -614,6 +623,12 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
614623
615624 enableTextChangedListener()
616625
626+ if (textSize + textSizeModifier >= 0 ) {
627+ setTextSize(TypedValue .COMPLEX_UNIT_PX , textSize + textSizeModifier)
628+ } else {
629+ setTextSize(TypedValue .COMPLEX_UNIT_PX , 0f )
630+ }
631+
617632 isViewInitialized = true
618633 }
619634
0 commit comments