Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FormattedText

Describes a text block with a certain style and size, in which the text can be arranged.

Hierarchy

  • FormattedText

Implements

Index

Constructors

constructor

  • Initializes a new instance of the FormattedText class.

    Parameters

    • text: string

      The text to be formatted.

    • font: Font

      The font.

    • maxTextWidth: number | undefined

      The maximum text width.

    • maxTextHeight: number | undefined

      The maximum text height.

    • flowDirection: FlowDirection

      The flow direction.

    • horizontalTextAlignment: HorizontalTextAlignment

      The horizontal text alignment.

    • verticalTextAlignment: VerticalTextAlignment

      The vertical text alignment.

    • textTrimming: TextTrimming

      The text trimming.

    Returns FormattedText

Properties

flowDirection

flowDirection: FlowDirection

Gets or sets the text flow, which can be different among certain cultures.

font

font: Font

Gets or sets the font that is used to render the text.

Optional height

height: number

Gets or sets the height of the boundaries and therefore, how many lines of text can be rendered. The specified text will be wrapped until the specified maxTextHeight is reached. The last line will then either be cut off or rendered will ellipsis, depending on the specified textTrimming.

horizontalTextAlignment

horizontalTextAlignment: HorizontalTextAlignment

Determines how text is arranged horizontally inside the boundaries.

text

text: string

Gets or sets the text to be formatted. The text can include line breaks.

textTrimming

textTrimming: TextTrimming

Determines how text is treated, that doesn't fit into the specified boundaries.

verticalTextAlignment

verticalTextAlignment: VerticalTextAlignment

Determines how text is arranged vertically inside the boundaries.

Optional width

width: number

Gets or sets the width of the boundaries and therefore, after how many millimeters the text is supposed to wrap.

Methods

measure

  • Measures the formatted text and returns a TextMeasurements object that contains information about the final size and layout.

    host

    Returns TextMeasurements

Private serialize

  • serialize(target: BufferWriter): void
  • Parameters

    • target: BufferWriter

    Returns void

Static create

  • Returns the formatted text that is defined by the specified description.

    Parameters

    Returns FormattedText

Static measure

Generated using TypeDoc