GoogleFont.Provider

class GoogleFont.Provider


Attributes used to create a FontRequest for a GoogleFont based Font.

See also
FontRequest

Summary

Public constructors

Provider(
    providerAuthority: String,
    providerPackage: String,
    certificates: @ArrayRes Int
)

Describe a downloadable fonts provider using a resource array for certificates.

Provider(
    providerAuthority: String,
    providerPackage: String,
    certificates: List<List<ByteArray>>
)

Describe a downloadable fonts provider using a list of certificates.

Public functions

open operator Boolean
equals(other: Any?)
open Int

Extension functions

Boolean

Check if the downloadable fonts provider is available on device.

Public constructors

Provider

Added in 1.2.0
Provider(
    providerAuthority: String,
    providerPackage: String,
    certificates: @ArrayRes Int
)

Describe a downloadable fonts provider using a resource array for certificates.

The font provider is matched by providerAuthority and packageName, then the resulting provider has it's certificates validated against certificates.

If the certificates check success, the provider is used for downloadable fonts.

If the certificates check fails, the provider will not be used and any downloadable fonts requests configured with it will fail.

Parameters
providerAuthority: String

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

providerPackage: String

The package for the Font Provider to be used for the request. This is used to verify the identity of the provider.

certificates: @ArrayRes Int

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.

Provider

Provider(
    providerAuthority: String,
    providerPackage: String,
    certificates: List<List<ByteArray>>
)

Describe a downloadable fonts provider using a list of certificates.

The font provider is matched by providerAuthority and packageName, then the resulting provider has it's certificates validated against certificates.

If the certificates check success, the provider is used for downloadable fonts.

If the certificates check fails, the provider will not be used and any downloadable fonts requests configured with it will fail.

Parameters
providerAuthority: String

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

providerPackage: String

The package for the Font Provider to be used for the request. This is used to verify the identity of the provider.

certificates: List<List<ByteArray>>

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.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Extension functions

@WorkerThread
fun GoogleFont.Provider.isAvailableOnDevice(context: Context): Boolean

Check if the downloadable fonts provider is available on device.

This is not necessary for normal usage, but may be useful in debugging downloadable fonts behavior.

Parameters
context: Context

for looking up font provider in

Returns
Boolean

true if the provider is usable for downloadable fonts, false if it's not found

Throws
kotlin.IllegalStateException

if the provider is on device, but certificates don't match