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
Format
The default text format applied to strings added without explicit formatting.
GlyphFormat Format { get; set; }
Property Value
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
indexVector2IX: Line Index, Y: Column Index
Property Value
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
Methods
Append(RichText)
Appends the given RichText to the end of the current content.
void Append(RichText text)
Parameters
textRichText
Append(char, GlyphFormat?)
Appends the char to the end of the current content.
void Append(char ch, GlyphFormat? format = null)
Parameters
chcharformatGlyphFormat?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
textstringformatGlyphFormat?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
textStringBuilderformatGlyphFormat?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
GetTextRange(Vector2I, Vector2I)
Returns the text within the specified range as RichText.
RichText GetTextRange(Vector2I start, Vector2I end)
Parameters
Returns
Insert(RichText, Vector2I)
Inserts the given RichText starting at the specified index.
void Insert(RichText text, Vector2I start)
Parameters
Insert(char, Vector2I, GlyphFormat?)
Inserts the char starting at the specified index.
void Insert(char text, Vector2I start, GlyphFormat? format = null)
Parameters
textcharstartVector2IInsertion index (X: Line, Y: Column).
formatGlyphFormat?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
textstringstartVector2IInsertion index (X: Line, Y: Column).
formatGlyphFormat?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
textStringBuilderstartVector2IInsertion index (X: Line, Y: Column).
formatGlyphFormat?Optional format to apply.
RemoveAt(Vector2I)
Removes the character at the specified index.
void RemoveAt(Vector2I index)
Parameters
indexVector2I
RemoveRange(Vector2I, Vector2I)
Removes all characters within the specified range.
void RemoveRange(Vector2I start, Vector2I end)
Parameters
SetFormatting(GlyphFormat)
Applies the specified formatting to the entire text content.
void SetFormatting(GlyphFormat format)
Parameters
formatGlyphFormat
SetFormatting(Vector2I, Vector2I, GlyphFormat)
Applies the specified formatting to the characters within the given range.
void SetFormatting(Vector2I start, Vector2I end, GlyphFormat format)
Parameters
startVector2IStart index.
endVector2IEnd index.
formatGlyphFormat
SetText(RichText)
Replaces the current text content with the provided RichText.
void SetText(RichText text)
Parameters
textRichText
SetText(string, GlyphFormat?)
Clears the current text and sets it to the provided string.
void SetText(string text, GlyphFormat? format = null)
Parameters
textstringformatGlyphFormat?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
textStringBuilderformatGlyphFormat?Optional format to apply. If null, Format is used.