ResourceFont
-
Cmn
class ResourceFont : Font
Defines a font to be used while rendering text with resource ID.
import androidx.compose.material.Text import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight val fontFamily = FontFamily( Font( resId = R.font.my_font_400_regular, weight = FontWeight.W400, style = FontStyle.Normal, ), Font( resId = R.font.my_font_400_italic, weight = FontWeight.W400, style = FontStyle.Italic, ), ) Text(text = "Demo Text", fontFamily = fontFamily)
| See also | |
|---|---|
FontFamily |
Summary
Public functions |
||
|---|---|---|
ResourceFont |
copy(resId: Int, weight: FontWeight, style: FontStyle) |
Cmn
|
ResourceFont |
@ExperimentalTextApi |
Cmn
|
open operator Boolean |
Cmn
|
|
open Int |
hashCode() |
Cmn
|
open String |
toString() |
Cmn
|
Public properties |
||
|---|---|---|
open FontLoadingStrategy |
Loading strategy for this font. |
Cmn
|
Int |
The resource ID of the font file in font resources. i.e. "R.font.myfont". |
Cmn
|
open FontStyle |
The style of the font, normal or italic. |
Cmn
|
FontVariation.Settings |
Cmn
|
|
open FontWeight |
The weight of the font. |
Cmn
|
Public functions
copy
fun copy(
resId: Int = this.resId,
weight: FontWeight = this.weight,
style: FontStyle = this.style
): ResourceFont
copy
@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
Public properties
loadingStrategy
@ExperimentalTextApi
open val loadingStrategy: FontLoadingStrategy
Loading strategy for this font.
style
open val style: FontStyle
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.TextStyle.
weight
open val weight: FontWeight
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.TextStyle.