ResourceFont

Class

Common
class ResourceFont
internal constructor(
    val resId: Int,
    override val weight: FontWeight = FontWeight.Normal,
    override val style: FontStyle = FontStyle.Normal,
    val variationSettings: FontVariation.Settings = FontVariation.Settings(weight, style),
    loadingStrategy: FontLoadingStrategy = FontLoadingStrategy.Async,
) : Font

Defines a font to be used while rendering text with resource ID.

Parameters

resIdThe resource ID of the font file in font resources. i.e. "R.font.myfont".
weightThe 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.TextStyle.
styleThe 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.TextStyle.
loadingStrategyLoad strategy for this font

Functions

fun copy(
        resId: Int = this.resId,
        weight: FontWeight = this.weight,
        style: FontStyle = this.style,
    ): ResourceFont
@ExperimentalTextApi
    fun copy(
        resId: Int = this.resId,
        weight: FontWeight = this.weight,
        style: FontStyle = this.style,
        loadingStrategy: FontLoadingStrategy = this.loadingStrategy,
        variationSettings: FontVariation.Settings = this.variationSettings,
    ): ResourceFont