Google is committed to advancing racial equity for Black communities. See how.

TypefaceCompat

open class TypefaceCompat
kotlin.Any
   ↳ androidx.core.graphics.TypefaceCompat

Helper for accessing features in Typeface.

Summary

Public methods
open static Typeface
create(@NonNull context: Context, @Nullable family: Typeface?, style: Int)

Retrieves the best matching typeface given the family, style and context.

Public methods

create

@NonNull open static fun create(
    @NonNull context: Context,
    @Nullable family: Typeface?,
    style: Int
): Typeface

Retrieves the best matching typeface given the family, style and context. If null is passed for the family, then the "default" font will be chosen.

Parameters
family Typeface?: The font family. May be null.
style Int: The style of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC
context Context: The context used to retrieve the font.
Return
Typeface The best matching typeface.