TextAppearanceSpanCompat


class TextAppearanceSpanCompat : MetricAffectingSpan


A TextAppearanceSpan works with Android X Downloadable Font

Summary

Public companion functions

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

Creates a TextAppearanceSpanCompat.

Public functions

open Unit
open Unit

Public companion functions

create

Added in 1.8.0-alpha01
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: Context

The context to use.

appearance: Int

The resource ID of a TextAppearance style.

colorList: Int

The resource ID of a ColorStateList.

executor: Executor

The executor to use for fetching the font.

onComplete: Runnable

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
TextAppearanceSpanCompat

A TextAppearanceSpanCompat.

Public functions

updateDrawState

Added in 1.8.0-alpha01
open fun updateDrawState(ds: TextPaint?): Unit

updateMeasureState

Added in 1.8.0-alpha01
open fun updateMeasureState(ds: TextPaint): Unit