Table of Contents

Interface ITextBuilder

Namespace
RichHudFramework.UI.Rendering
Assembly
RichHudClient.dll

A mutable collection of lines and characters that supports RichText formatting.

Functioning similarly to a StringBuilder, this interface allows for appending, inserting, and removing text while maintaining formatting data (colors, fonts) and handling line wrapping modes (Unlined, Lined, Wrapped).

Supports object.ToString() for getting plain text copies.

public interface ITextBuilder : IIndexedCollection<ILine>
Inherited Members

Remarks

ITextBuilder is the text building and formatting interface for ITextBoard. For details on usage, see that interface.

Properties

BuilderMode

Controls the line-breaking behavior of the text builder (Unlined, Lined, or Wrapped).

TextBuilderModes BuilderMode { get; set; }

Property Value

TextBuilderModes

Format

The default text format applied to strings added without explicit formatting.

GlyphFormat Format { get; set; }

Property Value

GlyphFormat

this[Vector2I]

Retrieves the IRichChar at the specified index.

Note: This creates a new wrapper object on every call. Avoid iterating this collection frequently in tight loops. Reference equality checks between calls will fail.

IRichChar this[Vector2I index] { get; }

Parameters

index Vector2I

X: Line Index, Y: Column Index

Property Value

IRichChar

LineWrapWidth

The maximum width of a line before text wraps to the next line.

Only applies when BuilderMode is set to Wrapped.

float LineWrapWidth { get; set; }

Property Value

float

Methods

Append(RichText)

Appends the given RichText to the end of the current content.

void Append(RichText text)

Parameters

text RichText

Append(char, GlyphFormat?)

Appends the char to the end of the current content.

void Append(char ch, GlyphFormat? format = null)

Parameters

ch char
format GlyphFormat?

Optional format to apply. If null, Format is used.

Append(string, GlyphFormat?)

Appends the string to the end of the current content.

void Append(string text, GlyphFormat? format = null)

Parameters

text string
format GlyphFormat?

Optional format to apply. If null, Format is used.

Append(StringBuilder, GlyphFormat?)

Appends a copy of the StringBuilder to the end of the current content.

void Append(StringBuilder text, GlyphFormat? format = null)

Parameters

text StringBuilder
format GlyphFormat?

Optional format to apply. If null, Format is used.

Clear()

Clears all existing text.

void Clear()

GetText()

Returns the entire contents of the text builder as RichText.

RichText GetText()

Returns

RichText

GetTextRange(Vector2I, Vector2I)

Returns the text within the specified range as RichText.

RichText GetTextRange(Vector2I start, Vector2I end)

Parameters

start Vector2I

Start index.

end Vector2I

End index.

Returns

RichText

Insert(RichText, Vector2I)

Inserts the given RichText starting at the specified index.

void Insert(RichText text, Vector2I start)

Parameters

text RichText
start Vector2I

Insertion index (X: Line, Y: Column).

Insert(char, Vector2I, GlyphFormat?)

Inserts the char starting at the specified index.

void Insert(char text, Vector2I start, GlyphFormat? format = null)

Parameters

text char
start Vector2I

Insertion index (X: Line, Y: Column).

format GlyphFormat?

Optional format to apply.

Insert(string, Vector2I, GlyphFormat?)

Inserts the string starting at the specified index.

void Insert(string text, Vector2I start, GlyphFormat? format = null)

Parameters

text string
start Vector2I

Insertion index (X: Line, Y: Column).

format GlyphFormat?

Optional format to apply.

Insert(StringBuilder, Vector2I, GlyphFormat?)

Inserts a copy of the StringBuilder starting at the specified index.

void Insert(StringBuilder text, Vector2I start, GlyphFormat? format = null)

Parameters

text StringBuilder
start Vector2I

Insertion index (X: Line, Y: Column).

format GlyphFormat?

Optional format to apply.

RemoveAt(Vector2I)

Removes the character at the specified index.

void RemoveAt(Vector2I index)

Parameters

index Vector2I

RemoveRange(Vector2I, Vector2I)

Removes all characters within the specified range.

void RemoveRange(Vector2I start, Vector2I end)

Parameters

start Vector2I

Start index.

end Vector2I

End index.

SetFormatting(GlyphFormat)

Applies the specified formatting to the entire text content.

void SetFormatting(GlyphFormat format)

Parameters

format GlyphFormat

SetFormatting(Vector2I, Vector2I, GlyphFormat)

Applies the specified formatting to the characters within the given range.

void SetFormatting(Vector2I start, Vector2I end, GlyphFormat format)

Parameters

start Vector2I

Start index.

end Vector2I

End index.

format GlyphFormat

SetText(RichText)

Replaces the current text content with the provided RichText.

void SetText(RichText text)

Parameters

text RichText

SetText(string, GlyphFormat?)

Clears the current text and sets it to the provided string.

void SetText(string text, GlyphFormat? format = null)

Parameters

text string
format GlyphFormat?

Optional format to apply. If null, Format is used.

SetText(StringBuilder, GlyphFormat?)

Clears the current text and sets it to a copy of the provided StringBuilder.

void SetText(StringBuilder text, GlyphFormat? format = null)

Parameters

text StringBuilder
format GlyphFormat?

Optional format to apply. If null, Format is used.