{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

PlatformTextStyle

public final class PlatformTextStyle


Provides platform specific TextStyle configuration options for styling and compatibility.

Summary

Public constructors

EmojiSupportMatch allows you to control emoji support replacement behavior.

PlatformTextStyle(boolean includeFontPadding)

Enables turning on and off for Android includeFontPadding.

PlatformTextStyle(
    PlatformSpanStyle spanStyle,
    PlatformParagraphStyle paragraphStyle
)

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

Public methods

boolean
equals(Object other)
final PlatformParagraphStyle

Platform specific paragraph styling and compatibility configuration.

final PlatformSpanStyle

Platform specific text span styling and compatibility configuration.

int
@NonNull String

Public constructors

PlatformTextStyle

public PlatformTextStyle(@NonNull EmojiSupportMatch emojiSupportMatch)

EmojiSupportMatch allows you to control emoji support replacement behavior.

You can disable emoji support matches by passing EmojiSupportMatch.None

Parameters
@NonNull EmojiSupportMatch emojiSupportMatch

configuration for emoji support match and replacement

PlatformTextStyle

public PlatformTextStyle(boolean includeFontPadding)

Enables turning on and off for Android includeFontPadding.

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
boolean includeFontPadding

Set whether to include extra space beyond font ascent and descent.

PlatformTextStyle

public PlatformTextStyle(
    PlatformSpanStyle spanStyle,
    PlatformParagraphStyle paragraphStyle
)

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

Parameters
PlatformSpanStyle spanStyle

platform specific span styling

PlatformParagraphStyle paragraphStyle

platform specific paragraph styling

Public methods

equals

public boolean equals(Object other)

getParagraphStyle

public final PlatformParagraphStyle getParagraphStyle()

Platform specific paragraph styling and compatibility configuration.

getSpanStyle

public final PlatformSpanStyle getSpanStyle()

Platform specific text span styling and compatibility configuration.

hashCode

public int hashCode()

toString

public @NonNull String toString()