MultiParagraphIntrinsics


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

Throws
kotlin.IllegalArgumentException

if ParagraphStyle.textDirection is not set, or any of the placeholders crosses paragraph boundary.

Summary

Public constructors

MultiParagraphIntrinsics(
    annotatedString: AnnotatedString,
    style: TextStyle,
    placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    fontFamilyResolver: FontFamily.Resolver
)
Cmn
MultiParagraphIntrinsics(
    annotatedString: AnnotatedString,
    style: TextStyle,
    placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    resourceLoader: Font.ResourceLoader
)

This function is deprecated. Font.ResourceLoader is deprecated, call with fontFamilyResolver

Cmn

Public properties

AnnotatedString

the text to be laid out

Cmn
open Boolean

Any Paragraph rendered using this ParagraphIntrinsics will be measured and drawn using stale resolved fonts.

Cmn
open Float

Returns the smallest width beyond which increasing the width never decreases the height.

Cmn
open Float

The width for text if all soft wrap opportunities were taken.

Cmn
List<AnnotatedString.Range<Placeholder>>

a list of Placeholders that specify ranges of text which will be skipped during layout and replaced with Placeholder.

Cmn

Public constructors

MultiParagraphIntrinsics

MultiParagraphIntrinsics(
    annotatedString: AnnotatedString,
    style: TextStyle,
    placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    fontFamilyResolver: FontFamily.Resolver
)
Parameters
annotatedString: AnnotatedString

the text to be laid out

style: TextStyle

the TextStyle to be applied to the whole text

placeholders: List<AnnotatedString.Range<Placeholder>>

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

density of the device

fontFamilyResolver: FontFamily.Resolver

Font.ResourceLoader to be used to load the font given in SpanStyles

MultiParagraphIntrinsics

MultiParagraphIntrinsics(
    annotatedString: AnnotatedString,
    style: TextStyle,
    placeholders: List<AnnotatedString.Range<Placeholder>>,
    density: Density,
    resourceLoader: Font.ResourceLoader
)

Public properties

annotatedString

val annotatedStringAnnotatedString

the text to be laid out

hasStaleResolvedFonts

open val hasStaleResolvedFontsBoolean

Any Paragraph rendered using this ParagraphIntrinsics will be measured and drawn using stale resolved fonts.

If this is false, this ParagraphIntrinsics is using the most current font resolution from FontFamily.Resolver.

If this is true, recreating this ParagraphIntrinsics will use new fonts from FontFamily.Resolver for both display and measurement. Recreating this ParagraphIntrinsics and displaying the resulting Paragraph causes user-visible reflow of the displayed text.

Once true, this will never become false without recreating this ParagraphIntrinsics.

It is discouraged, but safe, to continue to use this object after this becomes true. The only impact of using this object after hasStaleResolvedFonts becomes true is stale resolutions of async fonts for measurement and display.

maxIntrinsicWidth

open val maxIntrinsicWidthFloat

Returns the smallest width beyond which increasing the width never decreases the height.

minIntrinsicWidth

open val minIntrinsicWidthFloat

The width for text if all soft wrap opportunities were taken.

placeholders

val placeholdersList<AnnotatedString.Range<Placeholder>>

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.