Typeface
Function
Android
Deprecated This API is deprecated with the introduction of async fonts which cannot resolve in this context. To preload fonts, use FontFamily.Resolver.
fun Typeface(
context: Context,
fontFamily: FontFamily,
styles: List<Pair<FontWeight, FontStyle>>? = null,
): androidx.compose.ui.text.font.Typeface
Build an Android specific Typeface from FontFamily.
You can pass styles
for loading only specific styles.
This function caches the internal native Typeface but always create the new Typeface object. Caller should cache if necessary.
Parameters
context | the context to be used for loading Typeface. |
fontFamily | the font family to be loaded |
styles | optional style filter for loading subset of fontFamily. null means load all fonts in fontFamily. |
Returns
androidx.compose.ui.text.font.Typeface instance |
Android
fun Typeface(typeface: Typeface): androidx.compose.ui.text.font.Typeface
Returns a Compose androidx.compose.ui.text.font.Typeface
from Android Typeface
.
Parameters
typeface | Android Typeface instance |