> Documentation index: https://developer.android.com/reference/llms.txt

# ReusableTextStyleScope

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

  ```
  class ReusableTextStyleScope : TextStyleScope
  ```

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|---|
| `ReusableTextStyleScope()` | Cmn |

| ### Public functions |
|---|---|---|
| `Unit` | `copyFrom(other: ReusableTextStyleScope)` Copies all attributes from `other` into this `ReusableTextStyleScope`. | Cmn |
| `Boolean` | `hasSameDrawAffectingAttributes(other: ReusableTextStyleScope)` Returns whether this scope and `other` have equivalent draw-affecting attributes. | Cmn |
| `Boolean` | `hasSameDrawAffectingAttributes(style: TextStyle)` Returns whether this scope and `style` have equivalent draw-affecting attributes. | Cmn |
| `Boolean` | `hasSameLayoutAffectingAttributes(other: ReusableTextStyleScope)` Returns whether this scope and `other` have equivalent layout-affecting attributes. | Cmn |
| `Boolean` | `hasSameLayoutAffectingAttributes(style: TextStyle)` Returns whether this scope and `style` have equivalent layout-affecting attributes. | Cmn |
| `Unit` | `reset()` Resets all text attributes to their initial unspecified values. | Cmn |
| `open Unit` | `setAlpha(alpha: Float)` Sets the opacity of the text (0.0 to 1.0) applied when a brush is configured (via `setBrush` or `setTextStyle`). | Cmn |
| `open Unit` | `setBackground(background: Color)` Sets the background color covering the entire line height from start to end. | Cmn |
| `open Unit` | `setBaselineShift(baselineShift: BaselineShift)` Sets the vertical shift amount from the baseline (e.g., `BaselineShift.Superscript`). | Cmn |
| `open Unit` | `setBrush(brush: Brush)` Sets the `Brush` for painting the text, clearing any color previously set via `setColor` or `setTextStyle` (resetting it to `Color.Unspecified`). | Cmn |
| `open Unit` | `setColor(color: Color)` Sets the color to apply to the text. | Cmn |
| `open Unit` | `setDrawStyle(drawStyle: DrawStyle)` Sets the drawing style of the text (fill or stroke). | Cmn |
| `open Unit` | `setFontFamily(fontFamily: FontFamily)` Sets the font family used when rendering text. | Cmn |
| `open Unit` | `setFontFeatureSettings(fontFeatureSettings: String)` Sets advanced typography settings in CSS format (e.g., `"smcp"` for small caps). | Cmn |
| `open Unit` | `setFontSize(fontSize: TextUnit)` Sets the size of glyphs to use when painting the text (e.g., `16.sp`). | Cmn |
| `open Unit` | `setFontStyle(fontStyle: FontStyle)` Sets the typeface variant to use when drawing letters (e.g., `FontStyle.Italic`). | Cmn |
| `open Unit` | `setFontSynthesis(fontSynthesis: FontSynthesis)` Sets the font synthesis rules determining if and how bold/italic styles are synthesized when the font family does not natively support them. | Cmn |
| `open Unit` | `setFontWeight(fontWeight: FontWeight)` Sets the typeface thickness to use when painting the text (e.g., `FontWeight.Bold`). | Cmn |
| `open Unit` | `setHyphens(hyphens: Hyphens)` Sets the hyphenation configuration of the paragraph. | Cmn |
| `open Unit` | `setLetterSpacing(letterSpacing: TextUnit)` Sets the amount of space to add between letters (in SP or EM). | Cmn |
| `open Unit` | `setLineBreak(lineBreak: LineBreak)` Sets the line breaking configuration of the paragraph. | Cmn |
| `open Unit` | `setLineHeight(lineHeight: TextUnit)` Sets the line height for the paragraph (e.g., `24.sp`). | Cmn |
| `open Unit` | `setLineHeightStyle(lineHeightStyle: LineHeightStyle)` Sets the line height distribution configuration. | Cmn |
| `open Unit` | `setLocaleList(localeList: LocaleList)` Sets the locale list used to select region-specific glyphs. | Cmn |
| `open Unit` | `setPlatformStyle(platformStyle: PlatformTextStyle)` Sets platform-specific text styling parameters. | Cmn |
| `open Unit` | `setShadow(shadow: Shadow)` Sets the shadow effect applied to the text. | Cmn |
| `open Unit` | `setTextAlign(textAlign: TextAlign)` Sets the alignment of the text within lines of the paragraph. | Cmn |
| `open Unit` | `setTextDecoration(textDecoration: TextDecoration)` Sets the decorations to paint on the text (e.g., `TextDecoration.Underline`). | Cmn |
| `open Unit` | `setTextDirection(textDirection: TextDirection)` Sets the algorithm used to resolve text direction. | Cmn |
| `open Unit` | `setTextGeometricTransform( textGeometricTransform: TextGeometricTransform )` Sets the geometric transformation to apply to the text. | Cmn |
| `open Unit` | `setTextIndent(textIndent: TextIndent)` Sets the paragraph indentation. | Cmn |
| `open Unit` | `setTextMotion(textMotion: TextMotion)` Sets the text character placement optimization for animated or static text. | Cmn |
| `open Unit` | `setTextStyle(style: TextStyle)` Sets all text attributes from `style`. | Cmn |

| ### Public properties |
|---|---|---|
| `Float` | `alpha` Opacity of the text (0.0 to 1.0) applied when `brush` is provided, or `Float.NaN` if not set. | Cmn |
| `Color` | `background` Background color covering the entire line height from start to end, or `Color.Unspecified` if not set. | Cmn |
| `BaselineShift` | `baselineShift` Vertical shift amount from the baseline, or `BaselineShift.Unspecified` if not set. | Cmn |
| `Brush?` | `brush` `Brush` for painting the text, or `null` if not set. | Cmn |
| `Color` | `color` Color to apply to the text, or `Color.Unspecified` if not set. | Cmn |
| `DrawStyle?` | `drawStyle` Drawing style of the text (fill or stroke), or `null` if not set. | Cmn |
| `FontFamily?` | `fontFamily` Font family used when rendering text, or `null` if not set. | Cmn |
| `String?` | `fontFeatureSettings` Advanced typography settings in CSS format, or `null` if not set. | Cmn |
| `TextUnit` | `fontSize` Size of glyphs to use when painting the text, or `TextUnit.Unspecified` if not set. | Cmn |
| `FontStyle?` | `fontStyle` Typeface variant to use when drawing letters, or `null` if not set. | Cmn |
| `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. | Cmn |
| `FontWeight?` | `fontWeight` Typeface thickness to use when painting the text, or `null` if not set. | Cmn |
| `Hyphens` | `hyphens` Hyphenation configuration of the paragraph, or `Hyphens.Unspecified` if not set. | Cmn |
| `TextUnit` | `letterSpacing` Amount of space to add between letters, or `TextUnit.Unspecified` if not set. | Cmn |
| `LineBreak` | `lineBreak` Line breaking configuration of the paragraph, or `LineBreak.Unspecified` if not set. | Cmn |
| `TextUnit` | `lineHeight` Line height for the paragraph, or `TextUnit.Unspecified` if not set. | Cmn |
| `LineHeightStyle?` | `lineHeightStyle` Line height distribution configuration, or `null` if not set. | Cmn |
| `LocaleList?` | `localeList` Locale list used to select region-specific glyphs, or `null` if not set. | Cmn |
| `PlatformTextStyle?` | `platformStyle` Platform-specific text styling parameters, or `null` if not set. | Cmn |
| `Shadow?` | `shadow` Shadow effect applied to the text, or `null` if not set. | Cmn |
| `TextAlign` | `textAlign` Alignment of the text within lines of the paragraph, or `TextAlign.Unspecified` if not set. | Cmn |
| `TextDecoration?` | `textDecoration` Decorations to paint on the text, or `null` if not set. | Cmn |
| `TextDirection` | `textDirection` Algorithm used to resolve text direction, or `TextDirection.Unspecified` if not set. | Cmn |
| `TextGeometricTransform?` | `textGeometricTransform` Geometric transformation to apply to the text, or `null` if not set. | Cmn |
| `TextIndent?` | `textIndent` Paragraph indentation, or `null` if not set. | Cmn |
| `TextMotion?` | `textMotion` Text character placement optimization for animated or static text, or `null` if not set. | Cmn |

## Public constructors

### ReusableTextStyleScope

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
ReusableTextStyleScope()
```

## Public functions

### copyFrom

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun copyFrom(other: ReusableTextStyleScope): Unit
```

Copies all attributes from `other` into this `ReusableTextStyleScope`.

| Parameters |
|---|---|
| `other: ReusableTextStyleScope` | source scope to copy attributes from |

### hasSameDrawAffectingAttributes

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun hasSameDrawAffectingAttributes(other: ReusableTextStyleScope): Boolean
```

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

| Parameters |
|---|---|
| `other: ReusableTextStyleScope` | style scope to compare against |

| Returns |
|---|---|
| `Boolean` | `true` if all draw-affecting attributes match |

### hasSameDrawAffectingAttributes

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun hasSameDrawAffectingAttributes(style: TextStyle): Boolean
```

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

| Parameters |
|---|---|
| `style: TextStyle` | text style to compare against |

| Returns |
|---|---|
| `Boolean` | `true` if all draw-affecting attributes match |

### hasSameLayoutAffectingAttributes

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun hasSameLayoutAffectingAttributes(other: ReusableTextStyleScope): Boolean
```

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

| Parameters |
|---|---|
| `other: ReusableTextStyleScope` | style scope to compare against |

| Returns |
|---|---|
| `Boolean` | `true` if all layout-affecting attributes match |

### hasSameLayoutAffectingAttributes

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun hasSameLayoutAffectingAttributes(style: TextStyle): Boolean
```

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

| Parameters |
|---|---|
| `style: TextStyle` | text style to compare against |

| Returns |
|---|---|
| `Boolean` | `true` if all layout-affecting attributes match |

### reset

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun reset(): Unit
```

Resets all text attributes to their initial unspecified values.

### setAlpha

Cmn

```
open fun setAlpha(alpha: Float): Unit
```

Sets the opacity of the text (0.0 to 1.0) applied when a brush is configured (via `setBrush` or `setTextStyle`). Cleared when a specified color is set via `setColor` or when `setTextStyle` sets a style without a brush.

### setBackground

Cmn

```
open fun setBackground(background: Color): Unit
```

Sets the background color covering the entire line height from start to end.

### setBaselineShift

Cmn

```
open fun setBaselineShift(baselineShift: BaselineShift): Unit
```

Sets the vertical shift amount from the baseline (e.g., `BaselineShift.Superscript`). If `BaselineShift.Unspecified`, inherits from parent or default style.

### setBrush

Cmn

```
open fun setBrush(brush: Brush): Unit
```

Sets the `Brush` for painting the text, clearing any color previously set via `setColor` or `setTextStyle` (resetting it to `Color.Unspecified`).

### setColor

Cmn

```
open fun setColor(color: Color): Unit
```

Sets the color to apply to the text.

If `color` is specified (`color.isSpecified`), this clears any brush and alpha previously set via `setBrush`, `setAlpha`, or `setTextStyle`. If `color` is `Color.Unspecified`, any existing brush and alpha are preserved.

### setDrawStyle

Cmn

```
open fun setDrawStyle(drawStyle: DrawStyle): Unit
```

Sets the drawing style of the text (fill or stroke).

### setFontFamily

Cmn

```
open fun setFontFamily(fontFamily: FontFamily): Unit
```

Sets the font family used when rendering text.

### setFontFeatureSettings

Cmn

```
open fun setFontFeatureSettings(fontFeatureSettings: String): Unit
```

Sets advanced typography settings in CSS format (e.g., `"smcp"` for small caps).

### setFontSize

Cmn

```
open fun setFontSize(fontSize: TextUnit): Unit
```

Sets the size of glyphs to use when painting the text (e.g., `16.sp`).

### setFontStyle

Cmn

```
open fun setFontStyle(fontStyle: FontStyle): Unit
```

Sets the typeface variant to use when drawing letters (e.g., `FontStyle.Italic`).

### setFontSynthesis

Cmn

```
open fun setFontSynthesis(fontSynthesis: FontSynthesis): Unit
```

Sets the font synthesis rules determining if and how bold/italic styles are synthesized when the font family does not natively support them.

### setFontWeight

Cmn

```
open fun setFontWeight(fontWeight: FontWeight): Unit
```

Sets the typeface thickness to use when painting the text (e.g., `FontWeight.Bold`).

### setHyphens

Cmn

```
open fun setHyphens(hyphens: Hyphens): Unit
```

Sets the hyphenation configuration of the paragraph.

### setLetterSpacing

Cmn

```
open fun setLetterSpacing(letterSpacing: TextUnit): Unit
```

Sets the amount of space to add between letters (in SP or EM).

### setLineBreak

Cmn

```
open fun setLineBreak(lineBreak: LineBreak): Unit
```

Sets the line breaking configuration of the paragraph.

### setLineHeight

Cmn

```
open fun setLineHeight(lineHeight: TextUnit): Unit
```

Sets the line height for the paragraph (e.g., `24.sp`).

### setLineHeightStyle

Cmn

```
open fun setLineHeightStyle(lineHeightStyle: LineHeightStyle): Unit
```

Sets the line height distribution configuration.

### setLocaleList

Cmn

```
open fun setLocaleList(localeList: LocaleList): Unit
```

Sets the locale list used to select region-specific glyphs.

### setPlatformStyle

Cmn

```
open fun setPlatformStyle(platformStyle: PlatformTextStyle): Unit
```

Sets platform-specific text styling parameters.

### setShadow

Cmn

```
open fun setShadow(shadow: Shadow): Unit
```

Sets the shadow effect applied to the text.

### setTextAlign

Cmn

```
open fun setTextAlign(textAlign: TextAlign): Unit
```

Sets the alignment of the text within lines of the paragraph.

### setTextDecoration

Cmn

```
open fun setTextDecoration(textDecoration: TextDecoration): Unit
```

Sets the decorations to paint on the text (e.g., `TextDecoration.Underline`).

### setTextDirection

Cmn

```
open fun setTextDirection(textDirection: TextDirection): Unit
```

Sets the algorithm used to resolve text direction.

### setTextGeometricTransform

Cmn

```
open fun setTextGeometricTransform(
    textGeometricTransform: TextGeometricTransform
): Unit
```

Sets the geometric transformation to apply to the text.

### setTextIndent

Cmn

```
open fun setTextIndent(textIndent: TextIndent): Unit
```

Sets the paragraph indentation.

### setTextMotion

Cmn

```
open fun setTextMotion(textMotion: TextMotion): Unit
```

Sets the text character placement optimization for animated or static text.

### setTextStyle

Cmn

```
open fun setTextStyle(style: TextStyle): Unit
```

Sets all text attributes from `style`.

Overwrites all attributes in this scope with the values from `style`, resetting attributes that are unspecified or `null` in `style`. Call individual setter methods after `setTextStyle` to override specific attributes.

| Parameters |
|---|---|
| `style: TextStyle` | text style to copy attributes from |

## Public properties

### alpha

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val alpha: Float
```

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

### background

Cmn

```
val background: Color
```

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

### baselineShift

Cmn

```
val baselineShift: BaselineShift
```

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

### brush

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val brush: Brush?
```

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

### color

Cmn

```
val color: Color
```

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

### drawStyle

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val drawStyle: DrawStyle?
```

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

### fontFamily

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val fontFamily: FontFamily?
```

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

### fontFeatureSettings

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val fontFeatureSettings: String?
```

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

### fontSize

Cmn

```
val fontSize: TextUnit
```

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

### fontStyle

Cmn

```
val fontStyle: FontStyle?
```

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

### fontSynthesis

Cmn

```
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.

### fontWeight

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val fontWeight: FontWeight?
```

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

### hyphens

Cmn

```
val hyphens: Hyphens
```

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

### letterSpacing

Cmn

```
val letterSpacing: TextUnit
```

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

### lineBreak

Cmn

```
val lineBreak: LineBreak
```

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

### lineHeight

Cmn

```
val lineHeight: TextUnit
```

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

### lineHeightStyle

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val lineHeightStyle: LineHeightStyle?
```

Line height distribution configuration, or `null` if not set.

### localeList

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val localeList: LocaleList?
```

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

### platformStyle

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val platformStyle: PlatformTextStyle?
```

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

### shadow

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val shadow: Shadow?
```

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

### textAlign

Cmn

```
val textAlign: TextAlign
```

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

### textDecoration

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val textDecoration: TextDecoration?
```

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

### textDirection

Cmn

```
val textDirection: TextDirection
```

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

### textGeometricTransform

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val textGeometricTransform: TextGeometricTransform?
```

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

### textIndent

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val textIndent: TextIndent?
```

Paragraph indentation, or `null` if not set.

### textMotion

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val textMotion: TextMotion?
```

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