resolveAsTypeface

Function
Android
fun FontFamily.Resolver.resolveAsTypeface(
    fontFamily: FontFamily? = null,
    fontWeight: FontWeight = FontWeight.Normal,
    fontStyle: FontStyle = FontStyle.Normal,
    fontSynthesis: FontSynthesis = FontSynthesis.All,
): State<Typeface>

Resolve a font to an Android Typeface

On Android, font resolution always produces an android.graphics.Typeface.

This convenience method converts State to State to avoid casting the result.

Parameters

fontFamily fontFamily to resolve from
fontWeight font weight to resolve in fontFamily, will use closest match if not exact
fontStyle italic or upright text, to resolve in fontFamily
fontSynthesis allow font synthesis if fontFamily or fontStyle don't have an exact match. This will allow "fake bold" (drawing with too wide a brush) and "fake italic" (drawing then skewing) to be applied when no exact match is present for the weight and style.