requestFontWithFallbackChain

open fun requestFontWithFallbackChain(@NonNull context: Context, @NonNull requests: List<FontRequest>, style: Int, @Nullable loadingExecutor: Executor, @NonNull callbackExecutor: Executor, @NonNull callback: FontsContractCompat.FontRequestCallback)(source)

Request a font async as specified with FontRequest Loading may take several seconds, and the loadingExecutor passed should be available to run blocking requests for several seconds. Results will be returned via callbackExecutor.

Parameters

context

A context to be used for fetching from font provider

requests

An array of FontRequest objects that identify the provider and query for the request, followed by any fallbacks. Fallbacks are used in the order specified. Note that the performance implications of font fallback scale with the number of fonts involved, so the length of this parameter should be kept to a minimum; we recommend no more than 2 (that is, the primary font and a single downloadable custom fallback).

style

Typeface Style such as NORMAL, BOLDITALIC, BOLD_ITALIC.

loadingExecutor

executor to load font on. Loading may take several _seconds_. If null, a default executor shared with other null-requests will be used.

callbackExecutor

Used to dispatch callback

callback

A callback that will be triggered when results are obtained.