{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

DelegatingFontLoaderForDeprecatedUsageKt

public final class DelegatingFontLoaderForDeprecatedUsageKt


Summary

Public methods

static final @NonNull FontFamily.Resolver
createFontFamilyResolver(
    @NonNull Font.ResourceLoader fontResourceLoader,
    @NonNull Context context
)

This method is deprecated. This exists to bridge existing Font.ResourceLoader subclasses to be used as aFontFamily.ResourceLoader during upgrade.

Public methods

createFontFamilyResolver

public static final @NonNull FontFamily.Resolver createFontFamilyResolver(
    @NonNull Font.ResourceLoader fontResourceLoader,
    @NonNull Context context
)

Bridge between subclasses of Font.ResourceLoader and the new FontFamily.Resolver API.

To use add as a CompositionLocal replacing the default FontFamily.Resolver:

LocalFontFamilyResolver provides createFontFamilyResolver(myFontResourceLoader, context)

This FontFamily.Resolver is capable of loading all fonts that the default FontFamily.Resolver is. In addition, it will delegate all resource fonts to the provided Font.ResourceLoader, preserving the behavior of Compose 1.0.

This method will be removed by Compose 2.0, and callers should migrate to using AndroidFont to implement the same behavior using font fallback chains.

A FontFamily.Resolver created this way will not share caches with other FontFamily.Resolvers.