# AnimatedTextFontRegistry

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/AnimatedText.kt+class:androidx.wear.compose.material3.AnimatedTextFontRegistry) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)


```
@RequiresApi(value = 31)
class AnimatedTextFontRegistry
```

<br />

*** ** * ** ***

Generates fonts to be used by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AnimatedText.composable#AnimatedText(kotlin.String,androidx.wear.compose.material3.AnimatedTextFontRegistry,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.Alignment)` throughout the animation.

Start and end of the animation is when the animatable is at 0f and 1f, respectively. This API supports overshooting, so a generated font can be extrapolated outside `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AnimatedTextFontRegistry#(androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.font.FontVariation.Settings,androidx.compose.ui.text.font.FontVariation.Settings,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,androidx.compose.ui.graphics.Color,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AnimatedTextFontRegistry#(androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.font.FontVariation.Settings,androidx.compose.ui.text.font.FontVariation.Settings,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,androidx.compose.ui.graphics.Color,kotlin.Int)` range, developers need to make sure the given font supports possible font variation settings throughout the animation.

`https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AnimatedTextFontRegistry` can be re-used between multiple `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AnimatedText.composable#AnimatedText(kotlin.String,androidx.wear.compose.material3.AnimatedTextFontRegistry,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.Alignment)` composables to save memory and improve performance where needed and feasible.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AnimatedTextFontRegistry#AnimatedTextFontRegistry(androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.font.FontVariation.Settings,androidx.compose.ui.text.font.FontVariation.Settings,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,androidx.compose.ui.graphics.Color,kotlin.Int)( textStyle: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle, startFontVariationSettings: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontVariation.Settings, endFontVariationSettings: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontVariation.Settings, startFontSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit, endFontSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit, density: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density, fontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver, contentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

## Public constructors

### AnimatedTextFontRegistry

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
AnimatedTextFontRegistry(
    textStyle: TextStyle,
    startFontVariationSettings: FontVariation.Settings,
    endFontVariationSettings: FontVariation.Settings,
    startFontSize: TextUnit,
    endFontSize: TextUnit,
    density: Density,
    fontFamilyResolver: FontFamily.Resolver,
    contentColor: Color = textStyle.color,
    cacheSize: Int = AnimatedTextDefaults.CacheSize
)
```

| Parameters |
|---|---|
| `textStyle: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle` | Text style to be used for the animation |
| `startFontVariationSettings: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontVariation.Settings` | Font variation settings at the start of the animation |
| `endFontVariationSettings: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontVariation.Settings` | Font variation settings at the end of the animation |
| `startFontSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` | Font size at the start of the animation |
| `endFontSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` | Font size at the end of the animation |
| `density: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density` | Current density, used to convert font sizes |
| `fontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver` | Current Resolver to use to resolve font families |
| `contentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = textStyle.color` | Content color of the animated text |
| `cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = AnimatedTextDefaults.CacheSize` | Size of the cache used to store animated variable fonts, this can be increased to improve animation performance if needed, but it also increases the memory usage. |