Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Text

The text object is intended as character sequence manipulation interface. A text can be referenced by multiple labels for rendering and interaction. E.g., a single text could be rendered multiple times at different locations or using different font faces, alignments, etc. The text object will probably increase in complexity when additional features such as text formatting (bold, italic, varying size), (multi)cursor, (multi)selection, etc. will be added.

Hierarchy

  • Text

Index

Constructors

constructor

  • new Text(text?: undefined | string, lineFeed?: undefined | string): Text
  • Constructs a Text to be used for a Label.

    Parameters

    • Optional text: undefined | string

      the actual content of this Text.

    • Optional lineFeed: undefined | string

      char for lineFeed, default is LF.

    Returns Text

Properties

Protected _altered

_altered: boolean = false
see

altered

Protected _lineFeed

_lineFeed: string = Text.DEFAULT_LINE_FEED
see

lineFeed

Protected _text

_text: string
see

text

Static Readonly DEFAULT_LINE_FEED

DEFAULT_LINE_FEED: "" = ""

Accessors

altered

  • get altered(): boolean
  • set altered(altered: boolean): void

length

  • get length(): number
  • Length of the text, i.e., number of characters within the text.

    Returns number

lineFeed

  • get lineFeed(): string
  • set lineFeed(lineFeed: string): void

text

  • get text(): string
  • set text(text: string): void

Methods

charAt

  • charAt(index: number): string
  • Returns the character at the specified index.

    Parameters

    • index: number

      The zero-based index of the desired character.

    Returns string

    character at the specified index

charCodeAt

  • charCodeAt(index: number): number
  • Returns the Unicode value (codepoint) of the character at the specified location.

    Parameters

    • index: number

      The zero-based index of the desired character.

    Returns number

    • Codepoint of the character at given index or NaN, if no character exists at index.