TextAutoSizeLayoutScope


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.

Summary

Public functions

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

Lay out the text and return the result of the measurement

Cmn

Inherited functions

From androidx.compose.ui.unit.Density
open Int

Convert Dp to Int by rounding

Cmn
open Int

Convert Sp to Int by rounding

Cmn
open Dp

Convert an Int pixel value to Dp.

Cmn
open Dp

Convert a Float pixel value to a Dp

Cmn
open DpSize

Convert a Size to a DpSize.

Cmn
open Float

Convert Dp to pixels.

Cmn
open Float

Convert Sp to pixels.

Cmn
open Rect

Convert a DpRect to a Rect.

Cmn
open Size

Convert a DpSize to a Size.

Cmn
open TextUnit

Convert an Int pixel value to Sp.

Cmn
open TextUnit

Convert a Float pixel value to a Sp

Cmn
From androidx.compose.ui.unit.FontScaling
open Dp

Convert Sp to Dp.

Cmn
open TextUnit

Convert Dp to Sp.

Cmn

Inherited properties

From androidx.compose.ui.unit.Density
Float

The logical density of the display.

Cmn
From androidx.compose.ui.unit.FontScaling
Float

Current user preference for the scaling factor for fonts.

Cmn

Public functions

performLayout

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

Lay out the text and return the result of the measurement

Parameters
constraints: Constraints

The constraints to lay the text out with

text: AnnotatedString

The text to lay out

fontSize: TextUnit

The font size to lay the text out with

Returns
TextLayoutResult

The result of the measurement