PlatformTextStyle
expect class PlatformTextStyle
Provides platform specific TextStyle
configuration options for styling and compatibility.
Properties
val spanStyle: PlatformSpanStyle?
Platform specific text span styling and compatibility configuration.
val paragraphStyle: PlatformParagraphStyle?
Platform specific paragraph styling and compatibility configuration.
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
spanStyle | platform specific span styling |
paragraphStyle | platform 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
includeFontPadding | Set 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
emojiSupportMatch | configuration for emoji support match and replacement |
Properties
actual val spanStyle: PlatformSpanStyle?
Android specific text span styling and compatibility configuration.
actual val paragraphStyle: PlatformParagraphStyle?
Android specific paragraph styling and compatibility configuration.