Class

ReusableTextStyleScope

Mutable TextStyleScope implementation reused across layout and draw passes to avoid allocations.

Source set: Common
public class ReusableTextStyleScope : TextStyleScope

Mutable TextStyleScope implementation reused across layout and draw passes to avoid allocations.

Properties

color

Source set: Common
public var color: Color = Color.Unspecified

Color to apply to the text, or Color.Unspecified if not set.

brush

Source set: Common
public var brush: Brush? = null

Brush for painting the text, or null if not set.

alpha

Source set: Common
public var alpha: Float = Float.NaN

Opacity of the text (0.0 to 1.0) applied when brush is provided, or Float.NaN if not set.

fontSize

Source set: Common
public var fontSize: TextUnit = TextUnit.Unspecified

Size of glyphs to use when painting the text, or TextUnit.Unspecified if not set.

fontWeight

Source set: Common
public var fontWeight: FontWeight? = null

Typeface thickness to use when painting the text, or null if not set.

fontStyle

Source set: Common
public val fontStyle: FontStyle?

Typeface variant to use when drawing letters, or null if not set.

fontSynthesis

Source set: Common
public val fontSynthesis: FontSynthesis?

Font synthesis rules determining if and how bold/italic styles are synthesized when the font family does not natively support them, or null if not set.

fontFamily

Source set: Common
public var fontFamily: FontFamily? = null

Font family used when rendering text, or null if not set.

fontFeatureSettings

Source set: Common
public var fontFeatureSettings: String? = null

Advanced typography settings in CSS format, or null if not set.

letterSpacing

Source set: Common
public var letterSpacing: TextUnit = TextUnit.Unspecified

Amount of space to add between letters, or TextUnit.Unspecified if not set.

baselineShift

Source set: Common
public var baselineShift: BaselineShift = BaselineShift.Unspecified

Vertical shift amount from the baseline, or BaselineShift.Unspecified if not set.

textGeometricTransform

Source set: Common
public var textGeometricTransform: TextGeometricTransform? = null

Geometric transformation to apply to the text, or null if not set.

localeList

Source set: Common
public var localeList: LocaleList? = null

Locale list used to select region-specific glyphs, or null if not set.

background

Source set: Common
public var background: Color = Color.Unspecified

Background color covering the entire line height from start to end, or Color.Unspecified if not set.

textDecoration

Source set: Common
public var textDecoration: TextDecoration? = null

Decorations to paint on the text, or null if not set.

shadow

Source set: Common
public var shadow: Shadow? = null

Shadow effect applied to the text, or null if not set.

drawStyle

Source set: Common
public var drawStyle: DrawStyle? = null

Drawing style of the text (fill or stroke), or null if not set.

textAlign

Source set: Common
public val textAlign: TextAlign

Alignment of the text within lines of the paragraph, or TextAlign.Unspecified if not set.

textDirection

Source set: Common
public val textDirection: TextDirection

Algorithm used to resolve text direction, or TextDirection.Unspecified if not set.

lineHeight

Source set: Common
public var lineHeight: TextUnit = TextUnit.Unspecified

Line height for the paragraph, or TextUnit.Unspecified if not set.

textIndent

Source set: Common
public var textIndent: TextIndent? = null

Paragraph indentation, or null if not set.

platformStyle

Source set: Common
public var platformStyle: PlatformTextStyle? = null

Platform-specific text styling parameters, or null if not set.

lineHeightStyle

Source set: Common
public var lineHeightStyle: LineHeightStyle? = null

Line height distribution configuration, or null if not set.

lineBreak

Source set: Common
public val lineBreak: LineBreak

Line breaking configuration of the paragraph, or LineBreak.Unspecified if not set.

hyphens

Source set: Common
public val hyphens: Hyphens

Hyphenation configuration of the paragraph, or Hyphens.Unspecified if not set.

textMotion

Source set: Common
public var textMotion: TextMotion? = null

Text character placement optimization for animated or static text, or null if not set.

Functions

setTextStyle

Source set: Common
override fun setTextStyle(style: TextStyle)

setColor

Source set: Common
override fun setColor(color: Color)

setBrush

Source set: Common
override fun setBrush(brush: Brush)

setAlpha

Source set: Common
override fun setAlpha(alpha: Float)

setFontSize

Source set: Common
override fun setFontSize(fontSize: TextUnit)

setFontWeight

Source set: Common
override fun setFontWeight(fontWeight: FontWeight)

setFontStyle

Source set: Common
override fun setFontStyle(fontStyle: FontStyle)

setFontSynthesis

Source set: Common
override fun setFontSynthesis(fontSynthesis: FontSynthesis)

setFontFamily

Source set: Common
override fun setFontFamily(fontFamily: FontFamily)

setFontFeatureSettings

Source set: Common
override fun setFontFeatureSettings(fontFeatureSettings: String)

setLetterSpacing

Source set: Common
override fun setLetterSpacing(letterSpacing: TextUnit)

setBaselineShift

Source set: Common
override fun setBaselineShift(baselineShift: BaselineShift)

setTextGeometricTransform

Source set: Common
override fun setTextGeometricTransform(textGeometricTransform: TextGeometricTransform)

setLocaleList

Source set: Common
override fun setLocaleList(localeList: LocaleList)

setBackground

Source set: Common
override fun setBackground(background: Color)

setTextDecoration

Source set: Common
override fun setTextDecoration(textDecoration: TextDecoration)

setShadow

Source set: Common
override fun setShadow(shadow: Shadow)

setDrawStyle

Source set: Common
override fun setDrawStyle(drawStyle: DrawStyle)

setTextAlign

Source set: Common
override fun setTextAlign(textAlign: TextAlign)

setTextDirection

Source set: Common
override fun setTextDirection(textDirection: TextDirection)

setLineHeight

Source set: Common
override fun setLineHeight(lineHeight: TextUnit)

setTextIndent

Source set: Common
override fun setTextIndent(textIndent: TextIndent)

setPlatformStyle

Source set: Common
override fun setPlatformStyle(platformStyle: PlatformTextStyle)

setLineHeightStyle

Source set: Common
override fun setLineHeightStyle(lineHeightStyle: LineHeightStyle)

setLineBreak

Source set: Common
override fun setLineBreak(lineBreak: LineBreak)

setHyphens

Source set: Common
override fun setHyphens(hyphens: Hyphens)

setTextMotion

Source set: Common
override fun setTextMotion(textMotion: TextMotion)

reset

Source set: Common
public fun reset()

Resets all text attributes to their initial unspecified values.

hasSameLayoutAffectingAttributes

Source set: Common
public fun hasSameLayoutAffectingAttributes(other: ReusableTextStyleScope): Boolean

Returns whether this scope and other have equivalent layout-affecting attributes.

Parameters

other style scope to compare against

Return

true if all layout-affecting attributes match

hasSameLayoutAffectingAttributes

Source set: Common
public fun hasSameLayoutAffectingAttributes(style: TextStyle): Boolean

Returns whether this scope and style have equivalent layout-affecting attributes.

Parameters

style text style to compare against

Return

true if all layout-affecting attributes match

hasSameDrawAffectingAttributes

Source set: Common
public fun hasSameDrawAffectingAttributes(other: ReusableTextStyleScope): Boolean

Returns whether this scope and other have equivalent draw-affecting attributes.

Parameters

other style scope to compare against

Return

true if all draw-affecting attributes match

hasSameDrawAffectingAttributes

Source set: Common
public fun hasSameDrawAffectingAttributes(style: TextStyle): Boolean

Returns whether this scope and style have equivalent draw-affecting attributes.

Parameters

style text style to compare against

Return

true if all draw-affecting attributes match

copyFrom

Source set: Common
public fun copyFrom(other: ReusableTextStyleScope)

Copies all attributes from other into this ReusableTextStyleScope.

Parameters

other source scope to copy attributes from
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: