androidx.compose.ui.text.platform

Classes

FileFont

Defines a Font using file path.

android
FontLoadResult
android
FontLoader

This class is deprecated. Replaced with PlatformFontLoader during the introduction of async fonts, all usages should be replaced

android
LoadedFont

Defines a Font using byte array with loaded font data.

android
ParagraphLayouter

The purpose of this class is to store already built paragraph and pass it between different internal entities (from SkiaParagraphIntrinsics to SkiaParagraph).

android
PlatformFont
android
ResourceFont

Defines a Font using resource name.

android

Top-level functions summary

Font
Font(file: File, weight: FontWeight, style: FontStyle)

Creates a Font using file path.

android
Font
Font(resource: String, weight: FontWeight, style: FontStyle)

Creates a Font using resource name.

android
Font
Font(identity: String, data: ByteArray, weight: FontWeight, style: FontStyle)

Creates a Font using byte array with loaded font data.

android
Typeface
Typeface(typeface: Typeface, alias: String?)

Returns a Compose Typeface from Skia SkTypeface.

android

Extension functions summary

Top-level functions

Font

fun Font(
    file: File,
    weight: FontWeight = FontWeight.Normal,
    style: FontStyle = FontStyle.Normal
): Font

Creates a Font using file path.

Parameters
file: File

File path to font.

weight: FontWeight = FontWeight.Normal

The weight of the font. The system uses this to match a font to a font request that is given in a androidx.compose.ui.text.SpanStyle.

style: FontStyle = FontStyle.Normal

The style of the font, normal or italic. The system uses this to match a font to a font request that is given in a androidx.compose.ui.text.SpanStyle.

See also
FontFamily

Font

fun Font(
    resource: String,
    weight: FontWeight = FontWeight.Normal,
    style: FontStyle = FontStyle.Normal
): Font

Creates a Font using resource name.

Parameters
resource: String

The resource name in classpath.

weight: FontWeight = FontWeight.Normal

The weight of the font. The system uses this to match a font to a font request that is given in a androidx.compose.ui.text.SpanStyle.

style: FontStyle = FontStyle.Normal

The style of the font, normal or italic. The system uses this to match a font to a font request that is given in a androidx.compose.ui.text.SpanStyle.

See also
FontFamily

Font

fun Font(
    identity: String,
    data: ByteArray,
    weight: FontWeight = FontWeight.Normal,
    style: FontStyle = FontStyle.Normal
): Font

Creates a Font using byte array with loaded font data.

Parameters
identity: String

Unique identity for a font. Used internally to distinguish fonts.

data: ByteArray

Byte array with loaded font data.

weight: FontWeight = FontWeight.Normal

The weight of the font. The system uses this to match a font to a font request that is given in a androidx.compose.ui.text.SpanStyle.

style: FontStyle = FontStyle.Normal

The style of the font, normal or italic. The system uses this to match a font to a font request that is given in a androidx.compose.ui.text.SpanStyle.

See also
FontFamily

Typeface

fun Typeface(typeface: Typeface, alias: String? = null): Typeface

Returns a Compose Typeface from Skia SkTypeface.

Parameters
typeface: Typeface

Android Typeface instance

alias: String? = null

a shorter name that is used as an alternative to the full font name

Extension functions

toSkDecorationStyle

fun TextDecoration.toSkDecorationStyle(color: Color): DecorationStyle

toSkFontStyle

fun FontStyle.toSkFontStyle(): FontStyle