# GoogleFont.Provider

Artifact: [androidx.compose.ui:ui-text-google-fonts](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/googlefonts/GoogleFont.kt+class:androidx.compose.ui.text.googlefonts.GoogleFont.Provider) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)


```
class GoogleFont.Provider
```

<br />

*** ** * ** ***

Attributes used to create a `https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest` for a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont` based `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/Font`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont.Provider#Provider(kotlin.String,kotlin.String,kotlin.Int)( providerAuthority: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, providerPackage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, certificates: @https://developer.android.com/reference/kotlin/androidx/annotation/ArrayRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Describe a downloadable fonts provider using a resource array for certificates. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont.Provider#Provider(kotlin.String,kotlin.String,kotlin.collections.List)( providerAuthority: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, providerPackage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, certificates: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html>> )` Describe a downloadable fonts provider using a list of certificates. |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont.Provider#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont.Provider#hashCode()()` |

| ### Extension functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont.Provider.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/googlefonts/GoogleFont.Provider#(androidx.compose.ui.text.googlefonts.GoogleFont.Provider).isAvailableOnDevice(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Check if the downloadable fonts provider is available on device. |

## Public constructors

### Provider

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The authority of the Font Provider to be used for the request. |
| `providerPackage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package for the Font Provider to be used for the request. This is used to verify the identity of the provider. |
| `certificates: @https://developer.android.com/reference/kotlin/androidx/annotation/ArrayRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | 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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The authority of the Font Provider to be used for the request. |
| `providerPackage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package for the Font Provider to be used for the request. This is used to verify the identity of the provider. |
| `certificates: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html>>` | 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

### GoogleFont.Provider.isAvailableOnDevice

Artifact: [androidx.compose.ui:ui-text-google-fonts](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/googlefonts/GoogleFont.kt+function:isAvailableOnDevice)

```
@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: https://developer.android.com/reference/android/content/Context.html` | for looking up font provider in |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the provider is usable for downloadable fonts, false if it's not found |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the provider is on device, but certificates don't match |