FontRequest

Added in 1.1.0

public final class FontRequest


Information about a font request that may be sent to a Font Provider.

Summary

Nested types

public final class FontRequest.Builder

Builder for constructing FontRequest instances.

Public constructors

FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @ArrayRes int certificates
)
FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @NonNull List<List<byte[]>> certificates
)
FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @ArrayRes int certificates,
    @Nullable String variationSettings
)
FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @NonNull List<List<byte[]>> certificates,
    @Nullable String variationSettings
)

Public methods

@Nullable List<List<byte[]>>

Returns the list of certificate sets given for this provider.

@ArrayRes int

Returns the array resource id pointing to the certificate sets given for this provider.

@ArrayRes int

Returns the array resource id pointing to the debug fallback certificate sets given for this provider, or 0 if not set.

@NonNull String

Returns the selected font provider's authority.

@NonNull String

Returns the selected font provider's package.

@NonNull String

Returns the query string.

@Nullable List<List<byte[]>>

Returns the list of system certificate sets given for this provider.

@ArrayRes int

Returns the array resource id pointing to the system certificate sets given for this provider.

@Nullable String

Returns the font variation settings.

@NonNull String

Public constructors

FontRequest

Added in 1.1.0
public FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @ArrayRes int certificates
)
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. This is used to verify the identity of the provider.

@NonNull String query

The query to be sent over to the provider. Refer to your font provider's documentation on the format of this string.

@ArrayRes int certificates

A resource array with the list of sets of hashes for the certificates the provider should be signed with. This is used to verify the identity of the provider. Each set in the list represents one collection of signature hashes. Refer to your font provider's documentation for these values.

FontRequest

Added in 1.1.0
public FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @NonNull List<List<byte[]>> certificates
)
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. This is used to verify the identity of the provider.

@NonNull String query

The query to be sent over to the provider. Refer to your font provider's documentation on the format of this string.

@NonNull List<List<byte[]>> certificates

The list of sets of hashes for the certificates the provider should be signed with. This is used to verify the identity of the provider. Each set in the list represents one collection of signature hashes. Refer to your font provider's documentation for these values.

FontRequest

Added in 1.19.0
public FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @ArrayRes int certificates,
    @Nullable String variationSettings
)
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. This is used to verify the identity of the provider.

@NonNull String query

The query to be sent over to the provider. Refer to your font provider's documentation on the format of this string.

@ArrayRes int certificates

A resource array with the list of sets of hashes for the certificates the provider should be signed with. This is used to verify the identity of the provider. Each set in the list represents one collection of signature hashes. Refer to your font provider's documentation for these values.

@Nullable String variationSettings

String specifying the font variation settings (e.g. standard axes like weight, width, and slant, or custom axes) to be applied to a variable font when it is loaded. See setFontVariationSettings for more information about the format of the string. Supported on API 26 (Android O) and above. Note that these settings will only be effective if the font provider actually returns a variable font.

FontRequest

Added in 1.19.0
public FontRequest(
    @NonNull String providerAuthority,
    @NonNull String providerPackage,
    @NonNull String query,
    @NonNull List<List<byte[]>> certificates,
    @Nullable String variationSettings
)
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. This is used to verify the identity of the provider.

@NonNull String query

The query to be sent over to the provider. Refer to your font provider's documentation on the format of this string.

@NonNull List<List<byte[]>> certificates

The list of sets of hashes for the certificates the provider should be signed with. This is used to verify the identity of the provider. Each set in the list represents one collection of signature hashes. Refer to your font provider's documentation for these values.

@Nullable String variationSettings

String specifying the font variation settings (e.g. standard axes like weight, width, and slant, or custom axes) to be applied to a variable font when it is loaded. See setFontVariationSettings for more information about the format of the string. Supported on API 26 (Android O) and above. Note that these settings will only be effective if the font provider actually returns a variable font.

Public methods

getCertificates

Added in 1.1.0
public @Nullable List<List<byte[]>> getCertificates()

Returns the list of certificate sets given for this provider. This helps the system verify that the provider identified by the given authority is the one requested. Note this might be null if the certificates were provided via a resource id.

getCertificatesArrayResId

Added in 1.1.0
public @ArrayRes int getCertificatesArrayResId()

Returns the array resource id pointing to the certificate sets given for this provider. This helps the system verify that the provider identified by the given authority is the one requested. Note that this may be 0 if the certificates were provided as a list.

See also
getCertificates

getDebugFallbackCertificatesArrayResId

public @ArrayRes int getDebugFallbackCertificatesArrayResId()

Returns the array resource id pointing to the debug fallback certificate sets given for this provider, or 0 if not set.

getProviderAuthority

Added in 1.1.0
public @NonNull String getProviderAuthority()

Returns the selected font provider's authority. This tells the system what font provider it should request the font from.

getProviderPackage

Added in 1.1.0
public @NonNull String getProviderPackage()

Returns the selected font provider's package. This helps the system verify that the provider identified by the given authority is the one requested.

getQuery

Added in 1.1.0
public @NonNull String getQuery()

Returns the query string. Refer to your font provider's documentation on the format of this string.

getSystemCertificates

public @Nullable List<List<byte[]>> getSystemCertificates()

Returns the list of system certificate sets given for this provider. This helps the system verify that the provider identified by the given authority is the one requested, and is only trusted if the provider is installed as a system application (FLAG_SYSTEM or FLAG_UPDATED_SYSTEM_APP). Note this might be null if the certificates were provided via a resource id.

getSystemCertificatesArrayResId

public @ArrayRes int getSystemCertificatesArrayResId()

Returns the array resource id pointing to the system certificate sets given for this provider. This helps the system verify that the provider identified by the given authority is the one requested, and is only trusted if the provider is installed as a system application (FLAG_SYSTEM or FLAG_UPDATED_SYSTEM_APP). Note that this may be 0 if the certificates were provided as a list.

getVariationSettings

public @Nullable String getVariationSettings()

Returns the font variation settings. See setFontVariationSettings for more information about the format of the string.

toString

public @NonNull String toString()