Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextStyle

A text style combines one or more style attributes that can be applied to text. A style attribute consists of a style key and an appropriate value, such as SIZE and 12. If an attribute is added to an existing style that already contains that attribute, the new value replaces the old one.

Hierarchy

  • TextStyle

Implements

Index

Constructors

Methods

Constructors

constructor

  • new TextStyle(key1?: StyleKey, value1?: any, ...moreKeyValuePairs: any[]): TextStyle
  • Creates a new text style, adding the specified style attributes, if any.

    Parameters

    • Optional key1: StyleKey

      the first style key

    • Optional value1: any

      the value of the first style key

    • Rest ...moreKeyValuePairs: any[]

      additional pairs of styles and their values

    Returns TextStyle

Methods

add

  • add(key1: any, StyleKey: any, value1: any, ...moreKeyValuePairs: any[]): void
  • add(styleToMerge: TextStyle): void
  • Merges one or more styles attributes into this style.

    Parameters

    • key1: any

      the first style key

    • StyleKey: any
    • value1: any

      the value of the first style key

    • Rest ...moreKeyValuePairs: any[]

      additional pairs of styles and their values

    Returns void

  • Merges all of the style attributes of the specified style into this style.

    Parameters

    • styleToMerge: TextStyle

      the style to merge into this one

    Returns void

get

  • Returns the value of the style attribute with the specified key, or null if this style does not modify that key.

    Parameters

    • key: StyleKey

      the key to find the value for

    Returns any

    the value that the specified key is set to, or null

remove

  • Removes the style attribute with the specified key from the style. Has no effect if the style does not contain an attribute with that key.

    Parameters

    Returns void