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

fontFamilyfontFamily to resolve from
fontWeightfont weight to resolve in fontFamily, will use closest match if not exact
fontStyleitalic or upright text, to resolve in fontFamily
fontSynthesisallow 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.