# TextMeasurer

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/TextMeasurer.kt+class:androidx.compose.ui.text.TextMeasurer) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.3.0) Common/AllAndroid/JVM
- Cmn

  ```
  class TextMeasurer
  ```

*** ** * ** ***

Measures text to prepare it for drawing.

Create instances using `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/rememberTextMeasurer.composable#rememberTextMeasurer(kotlin.Int)` in Composable contexts to inherit default composition locals.

Caches layout results internally using an LRU cache to optimize repeated measure calls.

Reuses the cached layout when changing only draw-affected parameters:

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#color()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#brush()`

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#shadow()`

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#textDecoration()`

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#drawStyle()`

This makes animating draw-only parameters highly efficient.

Layout-affecting changes like text, font size, or constraints calculate a new layout. These new layouts may evict older entries once the cache reaches capacity.

Provide `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/Locale` during construction. `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer` uses these as defaults when skipped in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` calls.

## Summary

| ### Public constructors |
|---|---|
| `[TextMeasurer](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#TextMeasurer(androidx.compose.ui.text.font.FontFamily.Resolver,androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection,kotlin.Int))( defaultFontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver, defaultDensity: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density, defaultLayoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection, cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** Replace with overload that takes a default locale list | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#TextMeasurer(androidx.compose.ui.text.font.FontFamily.Resolver,androidx.compose.ui.text.intl.LocaleList,androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection,kotlin.Int)( defaultFontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver, defaultLocaleList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList, defaultDensity: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density, defaultLayoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection, cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)( text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle, overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow, softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints, layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection, density: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density, fontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver, skipCache: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, defaultLocaleList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` according to given parameters. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)( text: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString, style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle, overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow, softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, placeholders: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/Placeholder>>, constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints, layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection, density: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density, fontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver, skipCache: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, defaultLocaleList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` according to given parameters. | Cmn |

## Public constructors

### TextMeasurer

Cmn Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.3.0) Deprecated in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
[TextMeasurer](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#TextMeasurer(androidx.compose.ui.text.font.FontFamily.Resolver,androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection,kotlin.Int))(
    defaultFontFamilyResolver: FontFamily.Resolver,
    defaultDensity: Density,
    defaultLayoutDirection: LayoutDirection,
    cacheSize: Int = DefaultCacheSize
)
```

> [!CAUTION]
> **This function is deprecated.**   
> Replace with overload that takes a default locale list

### TextMeasurer

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
TextMeasurer(
    defaultFontFamilyResolver: FontFamily.Resolver,
    defaultLocaleList: LocaleList,
    defaultDensity: Density,
    defaultLayoutDirection: LayoutDirection,
    cacheSize: Int = DefaultCacheSize
)
```

| Parameters |
|---|---|
| `defaultFontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver` | resolver to load fonts defined in styles |
| `defaultLocaleList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList` | the default locale list to use for formatting. |
| `defaultDensity: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density` | density of the measurement environment, used for scaling fonts |
| `defaultLayoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` | layout direction of the measurement environment |
| `cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DefaultCacheSize` | sets the maximum number of cached layouts. Match this to the number of distinct layouts calculated repeatedly |

## Public functions

### measure

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
fun measure(
    text: String,
    style: TextStyle = TextStyle.Default,
    overflow: TextOverflow = TextOverflow.Clip,
    softWrap: Boolean = true,
    maxLines: Int = Int.MAX_VALUE,
    constraints: Constraints = Constraints(),
    layoutDirection: LayoutDirection = this.defaultLayoutDirection,
    density: Density = this.defaultDensity,
    fontFamilyResolver: FontFamily.Resolver = this.defaultFontFamilyResolver,
    skipCache: Boolean = false,
    defaultLocaleList: LocaleList = this.defaultLocaleList
): TextLayoutResult
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` according to given parameters.

This function supports laying out text that consists of multiple paragraphs, includes placeholders, wraps around soft line breaks, and might overflow outside the specified size.

Most parameters for text affect the final text layout. One pixel change in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` boundaries can displace a word to another line which would cause a chain reaction that completely changes how text is rendered.

On the other hand, some attributes only play a role when drawing the created text layout. For example text layout can be created completely in black color but we can apply `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#color()` later in draw phase. This also means that animating text color shouldn't invalidate text layout.

Thus, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#textLayoutCache()` helps in the process of converting a set of text layout inputs to a text layout while ignoring non-layout-affecting attributes. Iterative calls that use the same input parameters should benefit from substantial performance improvements.

```kotlin
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.sp

textMeasurer.measure(
    text = "Hello, World",
    style = TextStyle(color = Color.Red, fontSize = 16.sp, fontFamily = FontFamily.Cursive),
    constraints = Constraints(minWidth = 400, maxWidth = 400, minHeight = 200, maxHeight = 400),
)
```

| Parameters |
|---|---|
| `text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the text to be laid out |
| `style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle = TextStyle.Default` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle` to be applied to the whole text |
| `overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow = TextOverflow.Clip` | How visual overflow should be handled. |
| `softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether the text should break at soft line breaks. If false, the glyphs in the text will be positioned as if there was unlimited horizontal space. If `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` is false, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` and TextAlign may have unexpected effects. |
| `maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = Int.MAX_VALUE` | An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)`. If it is not null, then it must be greater than zero. |
| `constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints = Constraints()` | how wide and tall the text is allowed to be. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` will define the width of the MultiParagraph. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` helps defining the number of lines that fit with ellipsis is true. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` defines the minimum width the resulting `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult#size()` will report. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` is no-op. |
| `layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection = this.defaultLayoutDirection` | layout direction of the measurement environment. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |
| `density: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density = this.defaultDensity` | density of the measurement environment. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |
| `fontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver = this.defaultFontFamilyResolver` | to be used to load the font given in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle`s. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |
| `skipCache: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | Disables cache optimization if it is passed as true. |
| `defaultLocaleList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList = this.defaultLocaleList` | the locale list to use if none is specified as part of `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(kotlin.String,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)`. If specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |

### measure

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
fun measure(
    text: AnnotatedString,
    style: TextStyle = TextStyle.Default,
    overflow: TextOverflow = TextOverflow.Clip,
    softWrap: Boolean = true,
    maxLines: Int = Int.MAX_VALUE,
    placeholders: List<AnnotatedString.Range<Placeholder>> = listOf(),
    constraints: Constraints = Constraints(),
    layoutDirection: LayoutDirection = this.defaultLayoutDirection,
    density: Density = this.defaultDensity,
    fontFamilyResolver: FontFamily.Resolver = this.defaultFontFamilyResolver,
    skipCache: Boolean = false,
    defaultLocaleList: LocaleList = this.defaultLocaleList
): TextLayoutResult
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` according to given parameters.

This function supports laying out text that consists of multiple paragraphs, includes placeholders, wraps around soft line breaks, and might overflow outside the specified size.

Most parameters for text affect the final text layout. One pixel change in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` boundaries can displace a word to another line which would cause a chain reaction that completely changes how text is rendered.

On the other hand, some attributes only play a role when drawing the created text layout. For example text layout can be created completely in black color but we can apply `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle#color()` later in draw phase. This also means that animating text color shouldn't invalidate text layout.

Thus, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#textLayoutCache()` helps in the process of converting a set of text layout inputs to a text layout while ignoring non-layout-affecting attributes. Iterative calls that use the same input parameters should benefit from substantial performance improvements.

```kotlin
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.sp

textMeasurer.measure(
    text =
        buildAnnotatedString {
            append("Hello, ")
            withStyle(SpanStyle(color = Color.Blue)) { append("World!") }
        },
    style = TextStyle(fontSize = 16.sp, fontFamily = FontFamily.Monospace),
)
```

| Parameters |
|---|---|
| `text: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | the text to be laid out |
| `style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle = TextStyle.Default` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle` to be applied to the whole text |
| `overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow = TextOverflow.Clip` | How visual overflow should be handled. |
| `softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether the text should break at soft line breaks. If false, the glyphs in the text will be positioned as if there was unlimited horizontal space. If `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` is false, `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` and TextAlign may have unexpected effects. |
| `maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = Int.MAX_VALUE` | An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)`. If it is not null, then it must be greater than zero. |
| `placeholders: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString.Range<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/Placeholder>> = listOf()` | a list of `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/Placeholder`s that specify ranges of text which will be skipped during layout and replaced with `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/Placeholder`. It's required that the range of each `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/Placeholder` doesn't cross paragraph boundary, otherwise `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown. |
| `constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints = Constraints()` | how wide and tall the text is allowed to be. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` will define the width of the MultiParagraph. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` helps defining the number of lines that fit with ellipsis is true. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` defines the minimum width the resulting `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult#size()` will report. `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` is no-op. |
| `layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection = this.defaultLayoutDirection` | layout direction of the measurement environment. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |
| `density: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density = this.defaultDensity` | density of the measurement environment. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |
| `fontFamilyResolver: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/font/FontFamily.Resolver = this.defaultFontFamilyResolver` | to be used to load the font given in `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/SpanStyle`s. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |
| `skipCache: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | Disables cache optimization if it is passed as true. |
| `defaultLocaleList: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList = this.defaultLocaleList` | the locale list to use if none is specified as part of `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer#measure(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.collections.List,androidx.compose.ui.unit.Constraints,androidx.compose.ui.unit.LayoutDirection,androidx.compose.ui.unit.Density,androidx.compose.ui.text.font.FontFamily.Resolver,kotlin.Boolean,androidx.compose.ui.text.intl.LocaleList)`. If not specified, defaults to the value that was given during initialization of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer`. |