{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

TextMeasurerHelperKt

public final class TextMeasurerHelperKt


Summary

Public methods

static final @NonNull TextMeasurer

Creates and remembers a TextMeasurer.

Public methods

rememberTextMeasurer

@Composable
public static final @NonNull TextMeasurer rememberTextMeasurer(int cacheSize)

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. Moreover, the cache can be disabled at will during measure by passing in skipCache as true.

Parameters
int cacheSize

Capacity of internal cache inside TextMeasurer. Size unit is the number of unique text layout inputs that are measured.