Class

TextLayoutInput

Holds parameters used to compute text layout.

Source set: Common
public class TextLayoutInput private constructor(
    /** The text used for computing text layout. */
    public val text: AnnotatedString,

    /** The text layout used for computing this text layout. */
    public val style: TextStyle,

    /**
     * A list of [Placeholder]s inserted into text layout that reserves space to embed icons or
     * custom emojis. A list of bounding boxes will be returned in
     * [TextLayoutResult.placeholderRects] that corresponds to this input.
     *
     * @see TextLayoutResult.placeholderRects
     * @see MultiParagraph
     * @see MultiParagraphIntrinsics
     */
    public val placeholders: List<AnnotatedString.Range<Placeholder>>,

    /** The maxLines param used for computing this text layout. */
    public val maxLines: Int,

    /** The maxLines param used for computing this text layout. */
    public val softWrap: Boolean,

    /** The overflow param used for computing this text layout */
    public val overflow: TextOverflow,

    /** The density param used for computing this text layout. */
    public val density: Density,

    /** The layout direction used for computing this text layout. */
    public val layoutDirection: LayoutDirection,

    /**
     * The font resource loader used for computing this text layout.
     *
     * This is no longer used.
     *
     * @see fontFamilyResolver
     */
    @Suppress("DEPRECATION") resourceLoader: Font.ResourceLoader?,

    /** The font resolver used for computing this text layout. */
    public val fontFamilyResolver: FontFamily.Resolver,

    /**
     * The default locale list used for computing this text layout. This locale is used for
     * operations like line breaking and capitalization when no locale list is specified in the text
     * styles.
     */
    public val defaultLocaleList: LocaleList,

    /** The minimum width provided while calculating this text layout. */
    public val constraints: Constraints,
)

Holds parameters used to compute text layout.

Properties

resourceLoader

Source set: Common
@Deprecated(
        "Replaced with FontFamily.Resolver",
        replaceWith = ReplaceWith("fontFamilyResolver"),
    )
    public val resourceLoader: Font.ResourceLoader

Functions

copy

Source set: Common
@Deprecated(
        "Font.ResourceLoader is deprecated",
        replaceWith =
            ReplaceWith(
                "TextLayoutInput(text, style, placeholders," +
                    " maxLines, softWrap, overFlow, density, layoutDirection, fontFamilyResolver, " +
                    "constraints)"
            ),
    )
    // Unfortunately, there's no way to deprecate and add a parameter to a copy chain such that the
    // resolution is valid.
    //
    // However, as this was never intended to be a public function we will not replace it. There is
    // no use case for calling this method directly.
    public fun copy(
        text: AnnotatedString = this.text,
        style: TextStyle = this.style,
        placeholders: List<AnnotatedString.Range<Placeholder>> = this.placeholders,
        maxLines: Int = this.maxLines,
        softWrap: Boolean = this.softWrap,
        overflow: TextOverflow = this.overflow,
        density: Density = this.density,
        layoutDirection: LayoutDirection = this.layoutDirection,
        @Suppress("DEPRECATION") resourceLoader: Font.ResourceLoader = this.resourceLoader,
        constraints: Constraints = this.constraints,
    ): TextLayoutInput
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: