Package icyllis.modernui.text.style

# Class TypefaceSpan

java.lang.Object
icyllis.modernui.text.style.CharacterStyle
icyllis.modernui.text.style.MetricAffectingSpan
icyllis.modernui.text.style.TypefaceSpan

All Implemented Interfaces:
  `ParcelableSpan`, `UpdateAppearance`, `UpdateLayout`, `Parcelable`

public class TypefaceSpan extends MetricAffectingSpan implements ParcelableSpan

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable

  `Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TypefaceSpan(Typeface typeface)`
  Constructs a `TypefaceSpan` from a `Typeface`.
  `TypefaceSpan(Parcel src)`
  `TypefaceSpan(String family)`
  Constructs a `TypefaceSpan` based on the font family.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getFamily()`
  Returns the font family name set in the span.
  `int`
  `getSpanTypeId()`
  Return a special type identifier for this span class.
  `Typeface`
  `getTypeface()`
  Returns the typeface set in the span.
  `void`
  `updateMeasureState(TextPaint paint)`
  Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
  `void`
  `writeToParcel(Parcel dest, int flags)`
  The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.

  ### Methods inherited from class icyllis.modernui.text.style.MetricAffectingSpan

  `getUnderlying, updateDrawState`

  ### Methods inherited from class icyllis.modernui.text.style.CharacterStyle

  `wrap`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TypefaceSpan

    public TypefaceSpan(@Nullable String family)
    Constructs a `TypefaceSpan` based on the font family. The previous style of the TextPaint is kept. If the font family is null, the text paint is not modified.
    Parameters:
      `family` - The font family for this typeface. Examples include "monospace", "serif", and "sans-serif"

  - ### TypefaceSpan

    public TypefaceSpan(@NonNull Typeface typeface)
    Constructs a `TypefaceSpan` from a `Typeface`. The previous style of the TextPaint is overridden and the style of the typeface is used.
    Parameters:
      `typeface` - the typeface

  - ### TypefaceSpan

    public TypefaceSpan(@NonNull Parcel src)

- ## Method Details

  - ### getSpanTypeId

    public int getSpanTypeId()
    Description copied from interface: `ParcelableSpan`
    Return a special type identifier for this span class.
    Specified by:
      `getSpanTypeId` in interface `ParcelableSpan`

  - ### writeToParcel

    public void writeToParcel(@NonNull Parcel dest, int flags)
    Description copied from interface: `Parcelable`
    The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.
    Specified by:
      `writeToParcel` in interface `Parcelable`
    Parameters:
      `dest` - the parcel to write the object's data to
      `flags` - the flags about how the object should be written

  - ### getFamily

    @Nullable public String getFamily()
    Returns the font family name set in the span.
    Returns:
      the font family name
    See Also:
      - `TypefaceSpan(String)`

  - ### getTypeface

    @Nullable public Typeface getTypeface()
    Returns the typeface set in the span.
    Returns:
      the typeface set
    See Also:
      - `TypefaceSpan(Typeface)`

  - ### updateMeasureState

    public void updateMeasureState(@NonNull TextPaint paint)
    Description copied from class: `MetricAffectingSpan`
    Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
    Specified by:
      `updateMeasureState` in class `MetricAffectingSpan`
    Parameters:
      `paint` - the paint used for measuring the text