FontRequest.Builder


public final class FontRequest.Builder


Builder for constructing FontRequest instances.

Summary

Public constructors

Constructs a new Builder initialized with the properties of an existing FontRequest.

Builder(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @ArrayRes int systemCertificates
)

Constructs a new Builder for a system font provider.

Public methods

@NonNull FontRequest

Builds and returns the FontRequest instance.

@NonNull FontRequest.Builder
setDebugFallbackCertificates(@ArrayRes int debugFallbackCertificates)

Sets the optional debug fallback certificate resource array ID used to verify a non-system font provider during development or testing (for example, when testing against a local development build of GMSCore or running in Robolectric).

@NonNull FontRequest.Builder
setVariationSettings(@NonNull String variationSettings)

Sets the font variation settings to be applied to a variable font when loaded.

Public constructors

Builder

public Builder(@NonNull FontRequest request)

Constructs a new Builder initialized with the properties of an existing FontRequest.

Builder

public Builder(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @ArrayRes int systemCertificates
)

Constructs a new Builder for a system font provider.

Parameters
@NonNull String providerAuthority

The authority of the Font Provider to be used for the request.

@NonNull String providerPackage

The package for the Font Provider to be used for the request.

@NonNull String query

The query to be sent over to the provider.

@ArrayRes int systemCertificates

A resource array with the list of sets of hashes for the certificates the system provider should be signed with. The provider package must be installed on the system image (FLAG_SYSTEM or FLAG_UPDATED_SYSTEM_APP).

Public methods

build

public @NonNull FontRequest build()

Builds and returns the FontRequest instance.

setDebugFallbackCertificates

public @NonNull FontRequest.Builder setDebugFallbackCertificates(@ArrayRes int debugFallbackCertificates)

Sets the optional debug fallback certificate resource array ID used to verify a non-system font provider during development or testing (for example, when testing against a local development build of GMSCore or running in Robolectric).

Warning: Certificates provided here do not require FLAG_SYSTEM and bypass system app verification. Only use this method during development or testing.

setVariationSettings

public @NonNull FontRequest.Builder setVariationSettings(@NonNull String variationSettings)

Sets the font variation settings to be applied to a variable font when loaded.