Hierarchy (View Summary)

Implements

Constructors

Properties

_source: null | Lightning.types.TextureSource
clipping: boolean
isTexture: true
mh: number
mw: number
resizeMode: ResizeMode
type: undefined

Accessors

  • get advancedRenderer(): boolean
  • Enables the Advanced Text Renderer

    Returns boolean

    The Advanced Text Renderer adds support for:

    • <b> tag for bold text
      • Example: <b>This is bold</b>
    • <i> tag for italics text
      • Example: <i>This is italics</i>
    • <color=$ARGB> tag for colored text
      • Example: <color=0xff00ff00>This is green</color>
    • Enables the use of wordBreak

    See: https://github.com/rdkcentral/Lightning/pull/318 for more details

    false
    
  • set advancedRenderer(advancedRenderer: boolean): void
  • Enables the Advanced Text Renderer

    Parameters

    • advancedRenderer: boolean

    Returns void

    The Advanced Text Renderer adds support for:

    • <b> tag for bold text
      • Example: <b>This is bold</b>
    • <i> tag for italics text
      • Example: <i>This is italics</i>
    • <color=$ARGB> tag for colored text
      • Example: <color=0xff00ff00>This is green</color>
    • Enables the use of wordBreak

    See: https://github.com/rdkcentral/Lightning/pull/318 for more details

    false
    
  • get cutEx(): number
  • X coordinate of text cutting end position (in pixels)

    Returns number

    0

  • set cutEx(cutEx: number): void
  • X coordinate of text cutting end position (in pixels)

    Parameters

    • cutEx: number

    Returns void

    0

  • get cutEy(): number
  • Y coordinate of text cutting end position (in pixels)

    Returns number

    0

  • set cutEy(cutEy: number): void
  • Y coordinate of text cutting end position (in pixels)

    Parameters

    • cutEy: number

    Returns void

    0

  • get cutSx(): number
  • X coordinate of text cutting start position (in pixels)

    Returns number

    0

  • set cutSx(cutSx: number): void
  • X coordinate of text cutting start position (in pixels)

    Parameters

    • cutSx: number

    Returns void

    0

  • get cutSy(): number
  • Y coordinate of text cutting start position (in pixels)

    Returns number

    0

  • set cutSy(cutSy: number): void
  • Y coordinate of text cutting start position (in pixels)

    Parameters

    • cutSy: number

    Returns void

    0

  • get fontBaselineRatio(): number
  • Font baseline ratio (Advanced Text Renderer only)

    Returns number

    This can be used to improve vertical text alignment when using the Advanced Text Renderer.

    You MUST enable advancedRenderer in order to use this.

    See PR #378 for more information about this feature.

    To calculate the ratio for a particular font face, you can do this calculation from font metadata:

        (head.unitsPerEmhhea.Ascenderhhea.Descender) / (2 × head.unitsPerEm)
    

    This give you the ratio for the baseline, which is then used to figure out where the baseline is relative to the bottom of the text bounding box.

    The input values can be retrieved using the opentype.js Font Inspector.

    0

  • set fontBaselineRatio(fontBaselineRatio: number): void
  • Font baseline ratio (Advanced Text Renderer only)

    Parameters

    • fontBaselineRatio: number

    Returns void

    This can be used to improve vertical text alignment when using the Advanced Text Renderer.

    You MUST enable advancedRenderer in order to use this.

    See PR #378 for more information about this feature.

    To calculate the ratio for a particular font face, you can do this calculation from font metadata:

        (head.unitsPerEmhhea.Ascenderhhea.Descender) / (2 × head.unitsPerEm)
    

    This give you the ratio for the baseline, which is then used to figure out where the baseline is relative to the bottom of the text bounding box.

    The input values can be retrieved using the opentype.js Font Inspector.

    0

  • get fontFace(): string
  • Font family

    Returns string

    If an array is provided, font families that appear later in the array are used as fallbacks. If the (default) null value is specified, the font family value specified in the defaultFontFace Stage Option is used. If the resolved font family (or families) is unavailable to the browser, a fallback is chosen by the browser. The special CSS defined font family values of "serif" and "sans-serif" may be used as well.

    null (uses Stage.Options.defaultFontFace)

  • set fontFace(fontFace: string): void
  • Font family

    Parameters

    • fontFace: string

    Returns void

    If an array is provided, font families that appear later in the array are used as fallbacks. If the (default) null value is specified, the font family value specified in the defaultFontFace Stage Option is used. If the resolved font family (or families) is unavailable to the browser, a fallback is chosen by the browser. The special CSS defined font family values of "serif" and "sans-serif" may be used as well.

    null (uses Stage.Options.defaultFontFace)

  • get fontSize(): number
  • Font size (in pixels)

    Returns number

    40

  • set fontSize(fontSize: number): void
  • Font size (in pixels)

    Parameters

    • fontSize: number

    Returns void

    40

  • get fontStyle(): string
  • Font style

    Returns string

    "normal"

  • set fontStyle(fontStyle: string): void
  • Font style

    Parameters

    • fontStyle: string

    Returns void

    "normal"

  • get h(): number
  • Returns number

  • set h(v: number): void
  • Parameters

    • v: number

    Returns void

  • get highlightColor(): number
  • Highlight color

    Returns number

    highlight must be enabled for this property to have any affect.

    0xFF000000 (black)

  • set highlightColor(highlightColor: number): void
  • Highlight color

    Parameters

    • highlightColor: number

    Returns void

    highlight must be enabled for this property to have any affect.

    0xFF000000 (black)

  • get highlightHeight(): number
  • Highlight height (in pixels)

    Returns number

    highlight must be enabled for this property to have any affect.

    0 (fontSize multiplied by 1.5)

  • set highlightHeight(highlightHeight: number): void
  • Highlight height (in pixels)

    Parameters

    • highlightHeight: number

    Returns void

    highlight must be enabled for this property to have any affect.

    0 (fontSize multiplied by 1.5)

  • get highlightOffset(): number
  • Highlight Y offset (in pixels)

    Returns number

    Shifts the rendered highlight blocks down the Y-axis.

    highlight must be enabled for this property to have any affect.

    0

  • set highlightOffset(highlightOffset: number): void
  • Highlight Y offset (in pixels)

    Parameters

    • highlightOffset: number

    Returns void

    Shifts the rendered highlight blocks down the Y-axis.

    highlight must be enabled for this property to have any affect.

    0

  • get highlightPaddingLeft(): number
  • Highlight left padding (in pixels)

    Returns number

    • If > 0:
      • Adds additional highlight to the left of each highlighted line.
    • If < 0:
      • Removes highlight from the left side of each highlighted line.

    highlight must be enabled for this property to have any affect.

    0

  • set highlightPaddingLeft(highlightPaddingLeft: number): void
  • Highlight left padding (in pixels)

    Parameters

    • highlightPaddingLeft: number

    Returns void

    • If > 0:
      • Adds additional highlight to the left of each highlighted line.
    • If < 0:
      • Removes highlight from the left side of each highlighted line.

    highlight must be enabled for this property to have any affect.

    0

  • get highlightPaddingRight(): number
  • Highlight right padding (in pixels)

    Returns number

    • If > 0:
      • Adds additional highlight to the right of each highlighted line.
    • If < 0:
      • Removes highlight from the right side of each highlighted line.

    highlight must be enabled for this property to have any affect.

    0

  • set highlightPaddingRight(highlightPaddingRight: number): void
  • Highlight right padding (in pixels)

    Parameters

    • highlightPaddingRight: number

    Returns void

    • If > 0:
      • Adds additional highlight to the right of each highlighted line.
    • If < 0:
      • Removes highlight from the right side of each highlighted line.

    highlight must be enabled for this property to have any affect.

    0

  • get letterSpacing(): number
  • Spacing between letters

    Returns number

    Adds or removes spacing between letters. Negative values are allowed.

    Warning: Setting this to anything but 0 can slow down the rendering of text.

    0 (disabled)

  • set letterSpacing(letterSpacing: number): void
  • Spacing between letters

    Parameters

    • letterSpacing: number

    Returns void

    Adds or removes spacing between letters. Negative values are allowed.

    Warning: Setting this to anything but 0 can slow down the rendering of text.

    0 (disabled)

  • get lineHeight(): number
  • Line height (in pixels)

    Returns number

    null

  • set lineHeight(lineHeight: number): void
  • Line height (in pixels)

    Parameters

    • lineHeight: number

    Returns void

    null

  • get maxLines(): number
  • Maximum number of lines to display before truncation

    Returns number

    If this is set to a value greater than 0, multiline text will be truncated at this number of lines. The maxLinesSuffix will be inserted at the end of the last rendered line of text.

    0 (line truncation disabled)

  • set maxLines(maxLines: number): void
  • Maximum number of lines to display before truncation

    Parameters

    • maxLines: number

    Returns void

    If this is set to a value greater than 0, multiline text will be truncated at this number of lines. The maxLinesSuffix will be inserted at the end of the last rendered line of text.

    0 (line truncation disabled)

  • get maxLinesSuffix(): string
  • String rendered at the end of a truncated line of text

    Returns string

    This suffix is used in the following situations:

    ".."

  • set maxLinesSuffix(maxLinesSuffix: string): void
  • String rendered at the end of a truncated line of text

    Parameters

    • maxLinesSuffix: string

    Returns void

    This suffix is used in the following situations:

    ".."

  • get offsetY(): null | number
  • Text Y offset (in pixels)

    Returns null | number

    Translates the position of rendered text along the Y-axis.

    This value must be equal to at least the fontSize (which is the default) for the first line of text to be completely visible in the texture. If set to 0, the first line of text will be completely clipped.

    null (fontSize)

  • set offsetY(offsetY: null | number): void
  • Text Y offset (in pixels)

    Parameters

    • offsetY: null | number

    Returns void

    Translates the position of rendered text along the Y-axis.

    This value must be equal to at least the fontSize (which is the default) for the first line of text to be completely visible in the texture. If set to 0, the first line of text will be completely clipped.

    null (fontSize)

  • get paddingLeft(): number
  • Padding left (in pixels)

    Returns number

    Using this will result in a larger texture size allocation.

  • set paddingLeft(paddingLeft: number): void
  • Padding left (in pixels)

    Parameters

    • paddingLeft: number

    Returns void

    Using this will result in a larger texture size allocation.

  • get paddingRight(): number
  • Padding right (in pixels)

    Returns number

    Using this will result in a larger texture size allocation.

  • set paddingRight(paddingRight: number): void
  • Padding right (in pixels)

    Parameters

    • paddingRight: number

    Returns void

    Using this will result in a larger texture size allocation.

  • get text(): string
  • Text to display

    Returns string

    ""

  • set text(text: string): void
  • Text to display

    Parameters

    • text: string

    Returns void

    ""

  • get textColor(): number
  • Text color

    Returns number

    0xFFFFFFFF (white)

  • set textColor(textColor: number): void
  • Text color

    Parameters

    • textColor: number

    Returns void

    0xFFFFFFFF (white)

  • get textIndent(): number
  • Indent of the first line of text (in pixels)

    Returns number

    0

  • set textIndent(textIndent: number): void
  • Indent of the first line of text (in pixels)

    Parameters

    • textIndent: number

    Returns void

    0

  • get textOverflow(): TextOverflow
  • Text overflow mode

    Returns TextOverflow

    When enabled, truncates long blocks of text with a suffix (like "..") to the size specified in wordWrapWidth. wordWrap must be disabled for this to work.

    Values

    • "ellipsis": Truncated text will end in maxLinesSuffix.
    • "clip": Truncated text will not end in a suffix.
    • any string: Truncated text will end in this user-defined suffix.

    null (disabled)

  • set textOverflow(textOverflow: TextOverflow): void
  • Text overflow mode

    Parameters

    Returns void

    When enabled, truncates long blocks of text with a suffix (like "..") to the size specified in wordWrapWidth. wordWrap must be disabled for this to work.

    Values

    • "ellipsis": Truncated text will end in maxLinesSuffix.
    • "clip": Truncated text will not end in a suffix.
    • any string: Truncated text will end in this user-defined suffix.

    null (disabled)

  • get verticalAlign(): TextVerticalAlign
  • Vertical text aligment

    Returns TextVerticalAlign

    If lineHeight is larger than fontSize, this value specifies how text should be aligned vertically inside each line.

    "top"

  • set verticalAlign(verticalAlign: TextVerticalAlign): void
  • Vertical text aligment

    Parameters

    Returns void

    If lineHeight is larger than fontSize, this value specifies how text should be aligned vertically inside each line.

    "top"

  • get w(): number
  • Returns number

  • set w(v: number): void
  • Parameters

    • v: number

    Returns void

  • get wordBreak(): boolean
  • Word Breaking mode (Advanced Text Renderer only)

    Returns boolean

    When enabled, words that overflow the set width of the texture will be broken to another line.

    You MUST enable advancedRenderer in order to use this.

    false

  • set wordBreak(wordBreak: boolean): void
  • Word Breaking mode (Advanced Text Renderer only)

    Parameters

    • wordBreak: boolean

    Returns void

    When enabled, words that overflow the set width of the texture will be broken to another line.

    You MUST enable advancedRenderer in order to use this.

    false

  • get wordWrap(): boolean
  • Word wrap mode

    Returns boolean

    When enabled (default), long lines that exceed wordWrapWidth will be be broken into new lines.

    true

  • set wordWrap(wordWrap: boolean): void
  • Word wrap mode

    Parameters

    • wordWrap: boolean

    Returns void

    When enabled (default), long lines that exceed wordWrapWidth will be be broken into new lines.

    true

  • get wordWrapWidth(): number
  • Word wrap width (in pixels)

    Returns number

    • When wordWrap is enabled:
      • Long lines that exceed this width will be broken into new lines.
    • When wordWrap is disabled AND when textOverflow is enabled:
      • Text that exceeds this width will be truncated.

    0

  • set wordWrapWidth(wordWrapWidth: number): void
  • Word wrap width (in pixels)

    Parameters

    • wordWrapWidth: number

    Returns void

    • When wordWrap is enabled:
      • Long lines that exceed this width will be broken into new lines.
    • When wordWrap is disabled AND when textOverflow is enabled:
      • Text that exceeds this width will be truncated.

    0

  • get x(): number
  • Returns number

  • set x(v: number): void
  • Parameters

    • v: number

    Returns void

  • get y(): number
  • Returns number

  • set y(v: number): void
  • Parameters

    • v: number

    Returns void

Methods