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?: string, lineFeed?: string): Text
  • Constructs a Text to be used for a Label.

    Parameters

    • Optional text: string

      the actual content of this Text.

    • Optional lineFeed: string

      char for lineFeed, default is LF.

    Returns Text

Properties

Protected _altered

_altered: boolean = false
see

altered

Protected _lineFeed

_lineFeed: string = ...
see

lineFeed

Protected _text

_text: string
see

text

Static Readonly DEFAULT_LINE_FEED

DEFAULT_LINE_FEED: "\n" = '\x0A'

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.