getFontAsync

Resolves the requested font using the fontFamily, style, and typeface. Immediately (and synchronously) calls onFontRetrieved with the requested font, if it has been resolved already, or onFontRetrievalFailed if requested fontFamily is invalid. Otherwise callback is invoked asynchronously when the font is loaded (or async loading fails). While font is being fetched asynchronously, getFallbackFont can be used as a temporary font.

Parameters

context

the Context.

callback

callback to notify when font is loaded.

See also


open fun getFontAsync(@NonNull context: Context, @NonNull textPaint: TextPaint, @NonNull callback: TextAppearanceFontCallback)

Asynchronously resolves the requested font Typeface using the fontFamily, style, and typeface, and automatically updates given textPaint using updateTextPaintMeasureState on successful load.

Parameters

context

The Context.

textPaint

TextPaint to be updated.

callback

Callback to notify when font is available.

See also