brilliant-msg
    Preparing search index...

    Class TxTextSpriteBlock

    A block of text rendered as sprites, for use in a browser environment.

    Index

    Constructors

    Properties

    fontFamily: string

    The font family used for rendering the text.

    fontSize: number

    The font size used for rendering the text, in pixels.

    lineHeight: number

    The fixed line height for each sprite, in pixels.

    maxDisplayLines: number

    The maximum number of lines of text to be displayed.

    width: number

    The width constraint for the text layout, in pixels.

    Methods

    • Creates sprites from the rendered text using the browser's Canvas API. Returns an array of TxSprite instances, one per line of text. Each sprite has exactly lineHeight pixels in height and width pixels in width, except blank lines which are 1×lineHeight.

      Parameters

      • text: string

        The text to render. Lines are split on '\n'.

      Returns TxSprite[]

      Array of TxSprite instances.

    • Packs the text block header into a 6-byte binary format. Format: 0xFF (1 byte) | width (uint16 BE) | lineHeight (uint16 BE) | maxDisplayLines (uint8)

      Returns Uint8Array

      Uint8Array Binary representation of the text block header.