FontsContractCompat

public class FontsContractCompat


Utility class to deal with Font ContentProviders.

Summary

Nested types

FontsContractCompat.Columns

Defines the constants used in a response from a Font Provider.

FontsContractCompat.FontFamilyResult

Object returned from fetchFonts.

FontsContractCompat.FontInfo

Object represent a font entry in the family returned from fetchFonts.

FontsContractCompat.FontRequestCallback

Interface used to receive asynchronously fetched typefaces.

Public constructors

Public methods

static @Nullable Typeface
buildTypeface(
    @NonNull Context context,
    @Nullable CancellationSignal cancellationSignal,
    FontsContractCompat.FontInfo[] fonts
)

Build a Typeface from an array of FontInfo Results that are marked as not ready will be skipped.

static @NonNull FontsContractCompat.FontFamilyResult
fetchFonts(
    @NonNull Context context,
    @Nullable CancellationSignal cancellationSignal,
    @NonNull FontRequest request
)

Fetch fonts given a font request.

static void
requestFont(
    @NonNull Context context,
    @NonNull FontRequest request,
    @NonNull FontsContractCompat.FontRequestCallback callback,
    @NonNull Handler handler
)

Create a typeface object given a font request.

Public constructors

FontsContractCompat

public final FontsContractCompat()

Public methods

buildTypeface

public static @Nullable Typeface buildTypeface(
    @NonNull Context context,
    @Nullable CancellationSignal cancellationSignal,
    FontsContractCompat.FontInfo[] fonts
)

Build a Typeface from an array of FontInfo Results that are marked as not ready will be skipped.

Parameters
@NonNull Context context

A Context that will be used to fetch the font contents.