diff --git a/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditor.kt b/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditor.kt index 535e42e23..174c26417 100644 --- a/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditor.kt +++ b/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditor.kt @@ -1,6 +1,7 @@ package io.element.android.wysiwyg.compose import android.os.Build +import android.util.TypedValue import android.view.View import androidx.appcompat.widget.AppCompatEditText import androidx.compose.runtime.Composable @@ -172,6 +173,7 @@ private fun PreviewEditor( private fun AppCompatEditText.applyStyle(style: RichTextEditorStyle) { setTextColor(style.text.color.toArgb()) + setTextSize(TypedValue.COMPLEX_UNIT_SP, style.text.fontSize.value) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val cursorDrawable = ContextCompat.getDrawable(context, R.drawable.cursor) cursorDrawable?.setTint(style.cursor.color.toArgb()) diff --git a/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorDefaults.kt b/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorDefaults.kt index 22a44b8c0..aef13dadd 100644 --- a/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorDefaults.kt +++ b/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorDefaults.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp private val defaultCodeCornerRadius = 4.dp @@ -121,8 +122,10 @@ object RichTextEditorDefaults { @Composable fun textStyle( color: Color = MaterialTheme.colorScheme.onSurface, + fontSize: TextUnit = MaterialTheme.typography.bodyLarge.fontSize, ) = TextStyle( color = color, + fontSize = fontSize, ) /** diff --git a/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorStyle.kt b/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorStyle.kt index 8546e9c01..4b08f5aa6 100644 --- a/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorStyle.kt +++ b/platforms/android/library-compose/src/main/java/io/element/android/wysiwyg/compose/RichTextEditorStyle.kt @@ -6,6 +6,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.TextUnit import kotlin.math.roundToInt data class RichTextEditorStyle internal constructor( @@ -43,6 +44,7 @@ data class PillStyle( data class TextStyle( val color: Color, + val fontSize: TextUnit, ) data class CursorStyle(