Options
All
  • Public
  • Public/Protected
  • All
Menu

Canvas Rich Text library

Index

Variables

Const HtmlTokenizer

HtmlTokenizer: { createOptions: any; tokenizeString: any } = ...

Type declaration

Const defaultStyle

defaultStyle: StyleOptions = ...

The default style. You can modify this to affect how the text will be rendered.

Functions

arrangeText

  • Arranges Tokens into a randerable text.

    Parameters

    • tokens: Token[]

      An array of tokens for arranging, at the moment you either have to craft it manually or use tokenizeString to convert an HTML-string to an array of tokens.

    • options: Partial<ArrangeOptions>

      Arranging options.

    Returns ArrangedText

renderArrangedText

  • renderArrangedText(arrangedText: ArrangedText, target: CanvasRenderingContext2D, x?: number, y?: number): void
  • Renders the whole arranged text at the specified position.

    Parameters

    • arrangedText: ArrangedText

      The arranged text to render.

    • target: CanvasRenderingContext2D

      Canvas context on which to render

    • x: number = 0

      X position of the text in the canvas

    • y: number = 0

      Y position of the text in the canvas

    Returns void

renderLine

  • renderLine(line: ArrangedLine, target: CanvasRenderingContext2D, x?: number, y?: number): void
  • Renders a single arranged line at the specified position

    Parameters

    • line: ArrangedLine

      The line to render

    • target: CanvasRenderingContext2D

      Canvas context on which to render

    • x: number = 0

      X position of the line

    • y: number = 0

      Y position of the line

    Returns void

Generated using TypeDoc