AnimatedTextFontRegistry

@RequiresApi(value = 31)
class AnimatedTextFontRegistry


Generates fonts to be used by AnimatedText 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 startFontVariationSettings and endFontVariationSettings range, developers need to make sure the given font supports possible font variation settings throughout the animation.

AnimatedTextFontRegistry can be re-used between multiple AnimatedText composables to save memory and improve performance where needed and feasible.

Summary

Public constructors

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

Public constructors

AnimatedTextFontRegistry

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: TextStyle

Text style to be used for the animation

startFontVariationSettings: FontVariation.Settings

Font variation settings at the start of the animation

endFontVariationSettings: FontVariation.Settings

Font variation settings at the end of the animation

startFontSize: TextUnit

Font size at the start of the animation

endFontSize: TextUnit

Font size at the end of the animation

density: Density

Current density, used to to convert font sizes

fontFamilyResolver: FontFamily.Resolver

Current Resolver to use to resolve font families

contentColor: Color = textStyle.color

Content color of the animated text

cacheSize: Int = 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.