PlatformTextStyle

Class

Common
expect class PlatformTextStyle

Provides platform specific TextStyle configuration options for styling and compatibility.

Properties

Common
val spanStyle: PlatformSpanStyle?

Platform specific text span styling and compatibility configuration.

Common
val paragraphStyle: PlatformParagraphStyle?

Platform specific paragraph styling and compatibility configuration.

Android
actual class PlatformTextStyle

Provides Android specific TextStyle configuration options for styling and compatibility.

Secondary Constructors

constructor(spanStyle: PlatformSpanStyle?, paragraphStyle: PlatformParagraphStyle?) {
    this.spanStyle = spanStyle
    this.paragraphStyle = paragraphStyle
}

Convenience constructor for when you already have a spanStyle and paragraphStyle.

Parameters

spanStyleplatform specific span styling
paragraphStyleplatform specific paragraph styling
constructor(
    includeFontPadding: Boolean = DefaultIncludeFontPadding
) : this(
    paragraphStyle = PlatformParagraphStyle(includeFontPadding = includeFontPadding),
    spanStyle = null,
)

Enables turning on and off for Android includeFontPadding(https://developer.android.com/reference/android/text/StaticLayout.Builder#setIncludePad(boolean)).

includeFontPadding was added to Android in order to prevent clipping issues on tall scripts. However that issue has been fixed since Android 28. Jetpack Compose backports the fix for Android versions prior to Android 28. Therefore the original reason why includeFontPadding was needed in invalid on Compose.

This configuration was added for migration of the apps in case some code or design was relying includeFontPadding=true behavior.

Parameters

includeFontPaddingSet whether to include extra space beyond font ascent and descent.
constructor(
    emojiSupportMatch: EmojiSupportMatch
) : this(paragraphStyle = PlatformParagraphStyle(emojiSupportMatch), spanStyle = null)

EmojiSupportMatch allows you to control emoji support replacement behavior.

You can disable emoji support matches by passing EmojiSupportMatch.None

Parameters

emojiSupportMatchconfiguration for emoji support match and replacement

Properties

Android
actual val spanStyle: PlatformSpanStyle?

Android specific text span styling and compatibility configuration.

Android
actual val paragraphStyle: PlatformParagraphStyle?

Android specific paragraph styling and compatibility configuration.