TextStyle

Class

Android
class TextStyle(
    val color: ColorProvider = TextDefaults.defaultTextColor,
    val fontSize: TextUnit? = null,
    val fontWeight: FontWeight? = null,
    val fontStyle: FontStyle? = null,
    val textAlign: TextAlign? = null,
    val textDecoration: TextDecoration? = null,
    val fontFamily: FontFamily? = null,
)

Description of a text style for the androidx.glance.text.Text composable.

Parameters

coloroptionally specifies the color to use for the text, defaults to TextDefaults.defaultTextColor.
fontSizeoptionally specifies the size to use for the text, defaults to system when null.
fontWeightoptionally specifies the weight to use for the text, defaults to system when null.
fontStyleoptionally specifies style (such as italics) to use for the text, defaults to system when null.
textAlignoptionally specifies the alignment to use for the text, defaults to start when. null.
textDecorationoptionally specifies decorations (e.g. underline) to use for the text, defaults to none when null
fontFamilyoptionally specifies which font family to use for the text, defaults to system when null.

Functions

fun copy(
        color: ColorProvider = this.color,
        fontSize: TextUnit? = this.fontSize,
        fontWeight: FontWeight? = this.fontWeight,
        fontStyle: FontStyle? = this.fontStyle,
        textAlign: TextAlign? = this.textAlign,
        textDecoration: TextDecoration? = this.textDecoration,
        fontFamily: FontFamily? = this.fontFamily,
    ) =
        TextStyle(
            color = color,
            fontSize = fontSize,
            fontWeight = fontWeight,
            fontStyle = fontStyle,
            textAlign = textAlign,
            textDecoration = textDecoration,
            fontFamily = fontFamily,
        )