# FontRequestEmojiCompatConfig

Artifact: [androidx.emoji2:emoji2](https://developer.android.com/jetpack/androidx/releases/emoji2) [View Source](https://cs.android.com/search?q=file:androidx/emoji2/text/FontRequestEmojiCompatConfig.java+class:androidx.emoji2.text.FontRequestEmojiCompatConfig) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

*** ** * ** ***


```
class FontRequestEmojiCompatConfig : EmojiCompat.Config
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.emoji2.text.EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config) ||
|   | ↳ | [androidx.emoji2.text.FontRequestEmojiCompatConfig](https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig) |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` implementation that asynchronously fetches the required font and the metadata using a `https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest`. FontRequest should be constructed to fetch an EmojiCompat compatible emoji font.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy : https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig.RetryPolicy` A retry policy implementation that doubles the amount of time in between retries. |
| `abstract class https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig.RetryPolicy` Retry policy used when the font provider is not ready to give the font file. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig#FontRequestEmojiCompatConfig(android.content.Context,androidx.core.provider.FontRequest)(context: https://developer.android.com/reference/android/content/Context.html, request: https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest)` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig` | `[setHandler](https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig#setHandler(android.os.Handler))(handler: https://developer.android.com/reference/android/os/Handler.html?)` **This function is deprecated.** please call setLoadingExecutor instead <br /> |
| `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig` | `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig#setLoadingExecutor(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html)` Sets the custom executor to be used for initialization. |
| `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig` | `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig#setRetryPolicy(androidx.emoji2.text.FontRequestEmojiCompatConfig.RetryPolicy)(policy: https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig.RetryPolicy?)` Sets the retry policy. |

### Inherited functions

From [androidx.emoji2.text.EmojiCompat.Config](https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config) `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.MetadataRepoLoader` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#getMetadataRepoLoader()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.MetadataRepoLoader`.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#registerInitCallback(androidx.emoji2.text.EmojiCompat.InitCallback)(initCallback: https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.InitCallback)`

Registers an initialization callback.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#registerInitCallback(java.util.concurrent.Executor,androidx.emoji2.text.EmojiCompat.InitCallback)(
executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,
initCallback: https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.InitCallback
)`

Registers an initialization callback.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setEmojiSpanIndicatorColor(int)(color: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the color used as emoji span indicator.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setEmojiSpanIndicatorEnabled(boolean)(emojiSpanIndicatorEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Determines whether a background will be drawn for the emojis that are found and replaced by EmojiCompat.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setGlyphChecker(androidx.emoji2.text.EmojiCompat.GlyphChecker)(glyphChecker: https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.GlyphChecker)`

The interface that is used by EmojiCompat in order to check if a given emoji can be rendered by the system.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setMetadataLoadStrategy(int)(strategy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Determines the strategy to start loading the metadata.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setReplaceAll(boolean)(replaceAll: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Determines whether EmojiCompat should replace all the emojis it finds with the EmojiSpans.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setSpanFactory(androidx.emoji2.text.EmojiCompat.SpanFactory)(factory: https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.SpanFactory)`

Set the span factory used to actually draw emoji replacements.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setUseAfterUpdatableSystemFonts(boolean)(useAfter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Configure whether EmojiCompat should continue to process emojis and load metadata on devices that support Updatable System Fonts (API 35 and above).
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setUseEmojiAsDefaultStyle(boolean)(useEmojiAsDefaultStyle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Determines whether EmojiCompat should use the emoji presentation style for emojis that have text style as default.
`https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#setUseEmojiAsDefaultStyle(boolean,java.util.List<java.lang.Integer>)(
useEmojiAsDefaultStyle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html,
emojiAsDefaultStyleExceptions: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>?
)` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config` `https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.Config#unregisterInitCallback(androidx.emoji2.text.EmojiCompat.InitCallback)(initCallback: https://developer.android.com/reference/kotlin/androidx/emoji2/text/EmojiCompat.InitCallback)`

Unregisters a callback that was added before.

## Public constructors

### FontRequestEmojiCompatConfig

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

```
FontRequestEmojiCompatConfig(context: Context, request: FontRequest)
```

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | Context instance, cannot be `null` |
| `request: https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest` | `https://developer.android.com/reference/kotlin/androidx/core/provider/FontRequest` to fetch the font asynchronously, cannot be `null` |

## Public functions

### setHandler

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0) Deprecated in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

```
fun [setHandler](https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig#setHandler(android.os.Handler))(handler: Handler?): FontRequestEmojiCompatConfig
```

> [!CAUTION]
> **This function is deprecated.**   
>
> please call setLoadingExecutor instead

Please us `https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig#setLoadingExecutor(java.util.concurrent.Executor)` instead to set background loading thread. This was deprecated in emoji2 1.0.0-alpha04. If migrating from androidx.emoji please prefer to use an existing background executor for setLoadingExecutor. Note: This method will no longer have any effect if passed null, which is a breaking change from androidx.emoji.

| Parameters |
|---|---|
| `handler: https://developer.android.com/reference/android/os/Handler.html?` | background thread handler to wrap in an Executor, if null this method will do nothing |

### setLoadingExecutor

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

```
fun setLoadingExecutor(executor: Executor): FontRequestEmojiCompatConfig
```

Sets the custom executor to be used for initialization. Since font loading is too slow for the main thread, the metadata loader will fetch the fonts on a background thread. By default, FontRequestEmojiCompatConfig will create its own single threaded Executor, which causes a thread to be created. You can pass your own executor to control which thread the font is loaded on, and avoid an extra thread creation.

| Parameters |
|---|---|
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | background executor for performing font load |

### setRetryPolicy

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/emoji2#1.0.0)

```
fun setRetryPolicy(policy: FontRequestEmojiCompatConfig.RetryPolicy?): FontRequestEmojiCompatConfig
```

Sets the retry policy. {@see RetryPolicy}

| Parameters |
|---|---|
| `policy: https://developer.android.com/reference/kotlin/androidx/emoji2/text/FontRequestEmojiCompatConfig.RetryPolicy?` | The policy to be used when the font provider is not ready to give the font file. Can be `null`. In case of `null`, the metadata loader never retries. |