# TextAppearanceSpanCompat

Artifact: [androidx.appcompat:appcompat](https://developer.android.com/jetpack/androidx/releases/appcompat) [View Source](https://cs.android.com/search?q=file:androidx/appcompat/text/TextAppearanceSpanCompat.kt+class:androidx.appcompat.text.TextAppearanceSpanCompat) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.8.0)

*** ** * ** ***


```
class TextAppearanceSpanCompat : MetricAffectingSpan
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) |||
|   | ↳ | [android.text.style.MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html) ||
|   |   | ↳ | [androidx.appcompat.text.TextAppearanceSpanCompat](https://developer.android.com/reference/kotlin/androidx/appcompat/text/TextAppearanceSpanCompat) |

*** ** * ** ***

A TextAppearanceSpan works with Android X Downloadable Font

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/text/TextAppearanceSpanCompat` | `https://developer.android.com/reference/kotlin/androidx/appcompat/text/TextAppearanceSpanCompat#create(android.content.Context,kotlin.Int,kotlin.Int,java.util.concurrent.Executor,java.lang.Runnable)( context: https://developer.android.com/reference/android/content/Context.html, appearance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, colorList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, onComplete: https://developer.android.com/reference/java/lang/Runnable.html )` Creates a TextAppearanceSpanCompat. |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/text/TextAppearanceSpanCompat#updateDrawState(android.text.TextPaint)(ds: https://developer.android.com/reference/android/text/TextPaint.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/text/TextAppearanceSpanCompat#updateMeasureState(android.text.TextPaint)(ds: https://developer.android.com/reference/android/text/TextPaint.html)` |

### Inherited properties

From [android.text.style.MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html) `open https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html` `https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html#underlying`

## Public companion functions

### create

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.8.0)

```
fun create(
    context: Context,
    appearance: Int,
    colorList: Int,
    executor: Executor,
    onComplete: Runnable
): TextAppearanceSpanCompat
```

Creates a TextAppearanceSpanCompat.

The android:fontFamily may need to fetched asynchronously. The returned TextAppearanceSpanCompat may not immediately reflect the custom font, but it will be updated once the font is fetched. The provided callback will not be executed if the asynchronous fetch is not needed.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The context to use. |
| `appearance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The resource ID of a TextAppearance style. |
| `colorList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The resource ID of a ColorStateList. |
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | The executor to use for fetching the font. |
| `onComplete: https://developer.android.com/reference/java/lang/Runnable.html` | A runnable to be executed when the font fetching is complete. This runnable will be executed on the executor's thread. The client is responsible for invalidating the text layout if necessary. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/text/TextAppearanceSpanCompat` | A TextAppearanceSpanCompat. |

## Public functions

### updateDrawState

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.8.0)

```
open fun updateDrawState(ds: TextPaint?): Unit
```

### updateMeasureState

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.8.0)

```
open fun updateMeasureState(ds: TextPaint): Unit
```