androidx.compose.ui.text.font
Interfaces
Font |
The interface of the font resource. |
Typeface |
A class that can be used for changing the font used in text. |
Classes
FileBasedFontFamily |
A base class of FontFamilys that is created from file sources. |
FontFamily |
The base class of the font families. |
FontListFontFamily |
Defines a font family with list of Font. |
FontWeight |
The thickness of the glyphs, in a range of 1,1000. |
GenericFontFamily |
Defines a font family with an generic font family name. |
LoadedFontFamily |
Defines a font family that is already loaded Typeface. |
ResourceFont |
Defines a font to be used while rendering text with resource ID. |
SystemFontFamily |
A base class of FontFamilys installed on the system. |
Enums
FontStyle | |
FontSynthesis |
Possible options for font synthesis. |
Top-level functions summary
Font |
Font(resId: Int, weight: FontWeight = FontWeight.Normal, style: FontStyle = FontStyle.Normal) Creates a Font with using resource ID. |
FontFamily |
FontFamily(typeface: Typeface) Creates a FontFamily from Android Typeface. |
FontFamily |
FontFamily(fonts: List<Font>) Construct a font family that contains list of custom font files. |
FontFamily |
FontFamily(vararg fonts: Font) Construct a font family that contains list of custom font files. |
FontFamily |
FontFamily(typeface: Typeface) Construct a font family that contains loaded font family: Typeface. |
Typeface |
Typeface(context: Context, fontFamily: FontFamily, styles: List<Pair<FontWeight, FontStyle>>? = null) Build an Android specific Typeface from FontFamily. |
Typeface |
Returns a Compose androidx.compose.ui.text.font.Typeface from Android Typeface. |
FontWeight |
lerp(start: FontWeight, stop: FontWeight, fraction: Float) Linearly interpolate between two font weights. |
Extension functions summary
For Font | |
FontFamily |
Create a FontFamily from this single font. |
Top-level functions
Font
@Stable fun Font(
resId: Int,
weight: FontWeight = FontWeight.Normal,
style: FontStyle = FontStyle.Normal
): Font
Creates a Font with using resource ID.
Parameters | |
---|---|
resId: Int | The resource ID of the font file in font resources. i.e. "R.font.myfont". |
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
fun FontFamily(typeface: Typeface): FontFamily
Creates a FontFamily from Android Typeface.
Parameters | |
---|---|
typeface: Typeface | Android Typeface instance |
FontFamily
@Stable fun FontFamily(fonts: List<Font>): FontFamily
Construct a font family that contains list of custom font files.
Parameters | |
---|---|
fonts: List< |