Compose Unstyled 2.0 is out! Check the official announcement blog ->
Class

MultiParagraphIntrinsics

Calculates and provides the intrinsic width and height of text that contains ParagraphStyle.

Source set: Common
class MultiParagraphIntrinsics(
    val annotatedString: AnnotatedString,
    style: TextStyle,
    val placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    fontFamilyResolver: FontFamily.Resolver,
    softWrap: Boolean,
) : ParagraphIntrinsics

Calculates and provides the intrinsic width and height of text that contains ParagraphStyle.

Parameters

annotatedString the text to be laid out
style the TextStyle to be applied to the whole text
placeholders a list of Placeholders that specify ranges of text which will be skipped during layout and replaced with Placeholder. It's required that the range of each Placeholder doesn't cross paragraph boundary, otherwise IllegalArgumentException is thrown.
density density of the device
fontFamilyResolver Font.ResourceLoader to be used to load the font given in SpanStyles
softWrap Whether the text should break at soft line breaks. When the intention is to lay out text as a single line, setting softWrap to false enables optimizations that avoid certain expensive calculations

Secondary Constructors

constructor(
    annotatedString: AnnotatedString,
    style: TextStyle,
    placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    fontFamilyResolver: FontFamily.Resolver,
) : this(annotatedString, style, placeholders, density, fontFamilyResolver, true)
constructor(
    annotatedString: AnnotatedString,
    style: TextStyle,
    placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    resourceLoader: Font.ResourceLoader,
) : this(
    annotatedString,
    style,
    placeholders,
    density,
    createFontFamilyResolver(resourceLoader),
)

Last updated: