Google is committed to advancing racial equity for Black communities. See how.


Top-level functions summary

typefaceFromFontFamily(context: Context, fontFamily: FontFamily, necessaryStyles: List<Pair<FontWeight, FontStyle>>? = null)

Android specific Typeface builder function from FontFamily.

Top-level functions


fun typefaceFromFontFamily(
    context: Context,
    fontFamily: FontFamily,
    necessaryStyles: List<Pair<FontWeight, FontStyle>>? = null
): Typeface

Android specific Typeface builder function from FontFamily.

You can pass necessaryStyles for loading only specific styles. The font style matching happens only with the loaded Typeface.

This function caches the internal native Typeface but always create the new Typeface object. Caller should cache if necessary.

context: Context the context to be used for loading Typeface.
fontFamily: FontFamily the font family to be loaded
necessaryStyles: List<Pair<FontWeight, FontStyle>>? = null optional style filter for loading subset of fontFamily. null means load all fonts in fontFamily.
A loaded Typeface.