TextAutoSizeLayoutScope

Interface

Common
sealed interface TextAutoSizeLayoutScope : Density

An entity that allows performing text layout for auto sizing text.

These methods are used by TextAutoSize in the TextAutoSize.getFontSize method, where developers can lay out text with different font sizes and do certain logic depending on whether or not the text overflows.

Functions

fun performLayout(
        constraints: Constraints,
        text: AnnotatedString,
        fontSize: TextUnit,
    ): TextLayoutResult

Lay out the text and return the result of the measurement

Parameters

constraintsThe constraints to lay the text out with
textThe text to lay out
fontSizeThe font size to lay the text out with

Returns

The result of the measurement