---
title: "rememberTextMeasurer"
description: "Creates and remembers a [TextMeasurer]. All parameters that are required for [TextMeasurer]
except [cacheSize] are read from CompositionLocals. Created [TextMeasurer] carries an internal
[TextLayoutCache] with [cacheSize] capacity. Provide 0 for [cacheSize] to opt-out from internal
caching behavior."
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
@Composable
fun rememberTextMeasurer(cacheSize: Int = DefaultCacheSize): TextMeasurer
```


Creates and remembers a `TextMeasurer`. All parameters that are required for `TextMeasurer`
except `cacheSize` are read from CompositionLocals. Created `TextMeasurer` carries an internal
`TextLayoutCache` with `cacheSize` capacity. Provide 0 for `cacheSize` to opt-out from internal
caching behavior.

#### Parameters

| | |
| --- | --- |
| cacheSize | Capacity of internal cache inside `TextMeasurer`. Size unit is the number of unique text layout inputs that are measured. Value of this parameter highly depends on the consumer use case. Provide a cache size that is in line with how many distinct text layouts are going to be calculated by this measurer repeatedly. If you are animating font attributes, or any other layout affecting input, cache can be skipped because most repeated measure calls would miss the cache. |





