reckfellENGINE

TextParagraph

Holds a paragraph of text.

On this page
class TextParagraphReckfellSharpInherits RefCounted

Holds a paragraph of text.

Abstraction over TextServer for handling a single paragraph of text.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

TextParagraphConstructor
# TextParagraph
C#
public TextParagraph();

Properties13

AlignmentProperty
# Alignment
C#
public HorizontalAlignment Alignment { get; set; }

Paragraph horizontal alignment.

BreakFlagsProperty
# BreakFlags
C#
public TextServer.LineBreakFlag BreakFlags { get; set; }

Line breaking rules. For more info see TextServer.

CustomPunctuationProperty
# CustomPunctuation
C#
public string CustomPunctuation { get; set; }

Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.

DirectionProperty
# Direction
C#
public TextServer.Direction Direction { get; set; }

Text writing direction.

EllipsisCharProperty
# EllipsisChar
C#
public string EllipsisChar { get; set; }

Ellipsis character used for text clipping.

JustificationFlagsProperty
# JustificationFlags
C#
public TextServer.JustificationFlag JustificationFlags { get; set; }

Line fill alignment rules.

LineSpacingProperty
# LineSpacing
C#
public float LineSpacing { get; set; }

Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.

MaxLinesVisibleProperty
# MaxLinesVisible
C#
public int MaxLinesVisible { get; set; }

Limits the lines of text shown.

OrientationProperty
# Orientation
C#
public TextServer.Orientation Orientation { get; set; }

Text orientation.

PreserveControlProperty
# PreserveControl
C#
public bool PreserveControl { get; set; }

If set to true text will display control characters.

PreserveInvalidProperty
# PreserveInvalid
C#
public bool PreserveInvalid { get; set; }

If set to true text will display invalid characters.

TextOverrunBehaviorProperty
# TextOverrunBehavior
C#
public TextServer.OverrunBehavior TextOverrunBehavior { get; set; }

The clipping behavior when the text exceeds the paragraph's set width.

WidthProperty
# Width
C#
public float Width { get; set; }

Paragraph width.

Methods69

AddObjectbool
# AddObject
C#
public bool AddObject(Variant key, Vector2 size, InlineAlignment inlineAlign = InlineAlignment.Center, int length = 1, float baseline = 0f);

Adds inline object to the text buffer, key must be unique. In the text, object is represented as length object replacement characters.

Parameters
NameTypeDefault
keyVariant—
sizeVector2—
inlineAlignInlineAlignmentInlineAlignment.Center
lengthint1
baselinefloat0f
Returns bool
AddStringbool
# AddString
C#
public bool AddString(string text, Font font, int fontSize, string language = "", Variant meta = default);

Adds text span and font to draw it.

Parameters
NameTypeDefault
textstring—
fontFont—
fontSizeint—
languagestring""
metaVariantdefault
Returns bool
Clearvoid
# Clear
C#
public void Clear();

Clears text paragraph (removes text and inline objects).

ClearDropcapvoid
# ClearDropcap
C#
public void ClearDropcap();

Removes dropcap.

Draw2 overloads
# Draw · 1/2
C#
public void Draw(Rid canvas, Vector2 pos, Color? color, Color? dcColor);

Draw all lines of the text and drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
colorColor?—
dcColorColor?—
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

dcColor

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

# Draw · 2/2
C#
public void Draw(Rid canvas, Vector2 pos, Color? color = default, Color? dcColor = default, float oversampling = 0f);

Draw all lines of the text and drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
colorColor?default
dcColorColor?default
oversamplingfloat0f
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

dcColor

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

DrawDropcap2 overloads
# DrawDropcap · 1/2
C#
public void DrawDropcap(Rid canvas, Vector2 pos, Color? color);

Draw drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
colorColor?—
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

# DrawDropcap · 2/2
C#
public void DrawDropcap(Rid canvas, Vector2 pos, Color? color = default, float oversampling = 0f);

Draw drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
colorColor?default
oversamplingfloat0f
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

DrawDropcapOutline2 overloads
# DrawDropcapOutline · 1/2
C#
public void DrawDropcapOutline(Rid canvas, Vector2 pos, int outlineSize, Color? color);

Draw drop cap outline into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
outlineSizeint—
colorColor?—
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

# DrawDropcapOutline · 2/2
C#
public void DrawDropcapOutline(Rid canvas, Vector2 pos, int outlineSize = 1, Color? color = default, float oversampling = 0f);

Draw drop cap outline into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
outlineSizeint1
colorColor?default
oversamplingfloat0f
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

DrawLine2 overloads
# DrawLine · 1/2
C#
public void DrawLine(Rid canvas, Vector2 pos, int line, Color? color);

Draw single line of text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
lineint—
colorColor?—
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

# DrawLine · 2/2
C#
public void DrawLine(Rid canvas, Vector2 pos, int line, Color? color = default, float oversampling = 0f);

Draw single line of text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
lineint—
colorColor?default
oversamplingfloat0f
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

DrawLineOutline2 overloads
# DrawLineOutline · 1/2
C#
public void DrawLineOutline(Rid canvas, Vector2 pos, int line, int outlineSize, Color? color);

Draw outline of the single line of text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
lineint—
outlineSizeint—
colorColor?—
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

# DrawLineOutline · 2/2
C#
public void DrawLineOutline(Rid canvas, Vector2 pos, int line, int outlineSize = 1, Color? color = default, float oversampling = 0f);

Draw outline of the single line of text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
lineint—
outlineSizeint1
colorColor?default
oversamplingfloat0f
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

DrawOutline2 overloads
# DrawOutline · 1/2
C#
public void DrawOutline(Rid canvas, Vector2 pos, int outlineSize, Color? color, Color? dcColor);

Draw outlines of all lines of the text and drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
outlineSizeint—
colorColor?—
dcColorColor?—
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

dcColor

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

# DrawOutline · 2/2
C#
public void DrawOutline(Rid canvas, Vector2 pos, int outlineSize = 1, Color? color = default, Color? dcColor = default, float oversampling = 0f);

Draw outlines of all lines of the text and drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

Parameters
NameTypeDefault
canvasRid—
posVector2—
outlineSizeint1
colorColor?default
dcColorColor?default
oversamplingfloat0f
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

dcColor

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

DuplicateTextParagraph
# Duplicate
C#
public TextParagraph Duplicate();

Duplicates this TextParagraph.

Returns TextParagraph
GetAlignmentHorizontalAlignment
# GetAlignment
C#
public HorizontalAlignment GetAlignment();
Returns HorizontalAlignment
GetBreakFlagsTextServer.LineBreakFlag
# GetBreakFlags
C#
public TextServer.LineBreakFlag GetBreakFlags();
Returns TextServer.LineBreakFlag
GetCustomPunctuationstring
# GetCustomPunctuation
C#
public string GetCustomPunctuation();
Returns string
GetDirectionTextServer.Direction
# GetDirection
C#
public TextServer.Direction GetDirection();
Returns TextServer.Direction
GetDropcapLinesint
# GetDropcapLines
C#
public int GetDropcapLines();

Returns number of lines used by dropcap.

Returns int
GetDropcapRidRid
# GetDropcapRid
C#
public Rid GetDropcapRid();

Returns drop cap text buffer RID.

Returns Rid
GetDropcapSizeVector2
# GetDropcapSize
C#
public Vector2 GetDropcapSize();

Returns drop cap bounding box size.

Returns Vector2
GetEllipsisCharstring
# GetEllipsisChar
C#
public string GetEllipsisChar();
Returns string
GetInferredDirectionTextServer.Direction
# GetInferredDirection
C#
public TextServer.Direction GetInferredDirection();

Returns the text writing direction inferred by the BiDi algorithm.

Returns TextServer.Direction
GetJustificationFlagsTextServer.JustificationFlag
# GetJustificationFlags
C#
public TextServer.JustificationFlag GetJustificationFlags();
Returns TextServer.JustificationFlag
GetLineAscentfloat
# GetLineAscent
C#
public float GetLineAscent(int line);

Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).

Parameters
NameTypeDefault
lineint—
Returns float
GetLineCountint
# GetLineCount
C#
public int GetLineCount();

Returns number of lines in the paragraph.

Returns int
GetLineDescentfloat
# GetLineDescent
C#
public float GetLineDescent(int line);

Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).

Parameters
NameTypeDefault
lineint—
Returns float
GetLineObjectRectRect2
# GetLineObjectRect
C#
public Rect2 GetLineObjectRect(int line, Variant key);

Returns bounding rectangle of the inline object.

Parameters
NameTypeDefault
lineint—
keyVariant—
Returns Rect2
GetLineObjectsReckfell.Collections.Array
# GetLineObjects
C#
public Reckfell.Collections.Array GetLineObjects(int line);

Returns array of inline objects in the line.

Parameters
NameTypeDefault
lineint—
Returns Reckfell.Collections.Array
GetLineRangeVector2I
# GetLineRange
C#
public Vector2I GetLineRange(int line);

Returns character range of the line.

Parameters
NameTypeDefault
lineint—
Returns Vector2I
GetLineRidRid
# GetLineRid
C#
public Rid GetLineRid(int line);

Returns TextServer line buffer RID.

Parameters
NameTypeDefault
lineint—
Returns Rid
GetLineSizeVector2
# GetLineSize
C#
public Vector2 GetLineSize(int line);

Returns size of the bounding box of the line of text. Returned size is rounded up.

Parameters
NameTypeDefault
lineint—
Returns Vector2
GetLineSpacingfloat
# GetLineSpacing
C#
public float GetLineSpacing();
Returns float
GetLineUnderlinePositionfloat
# GetLineUnderlinePosition
C#
public float GetLineUnderlinePosition(int line);

Returns pixel offset of the underline below the baseline.

Parameters
NameTypeDefault
lineint—
Returns float
GetLineUnderlineThicknessfloat
# GetLineUnderlineThickness
C#
public float GetLineUnderlineThickness(int line);

Returns thickness of the underline.

Parameters
NameTypeDefault
lineint—
Returns float
GetLineWidthfloat
# GetLineWidth
C#
public float GetLineWidth(int line);

Returns width (for horizontal layout) or height (for vertical) of the line of text.

Parameters
NameTypeDefault
lineint—
Returns float
GetMaxLinesVisibleint
# GetMaxLinesVisible
C#
public int GetMaxLinesVisible();
Returns int
GetNonWrappedSizeVector2
# GetNonWrappedSize
C#
public Vector2 GetNonWrappedSize();

Returns the size of the bounding box of the paragraph, without line breaks.

Returns Vector2
GetOrientationTextServer.Orientation
# GetOrientation
C#
public TextServer.Orientation GetOrientation();
Returns TextServer.Orientation
GetPreserveControlbool
# GetPreserveControl
C#
public bool GetPreserveControl();
Returns bool
GetPreserveInvalidbool
# GetPreserveInvalid
C#
public bool GetPreserveInvalid();
Returns bool
GetRangeVector2I
# GetRange
C#
public Vector2I GetRange();

Returns the character range of the paragraph.

Returns Vector2I
GetRidRid
# GetRid
C#
public Rid GetRid();

Returns TextServer full string buffer RID.

Returns Rid
GetSizeVector2
# GetSize
C#
public Vector2 GetSize();

Returns the size of the bounding box of the paragraph.

Returns Vector2
GetTextOverrunBehaviorTextServer.OverrunBehavior
# GetTextOverrunBehavior
C#
public TextServer.OverrunBehavior GetTextOverrunBehavior();
Returns TextServer.OverrunBehavior
GetWidthfloat
# GetWidth
C#
public float GetWidth();
Returns float
HasObjectbool
# HasObject
C#
public bool HasObject(Variant key);

Returns true if an object with key is embedded in this shaped text buffer.

Parameters
NameTypeDefault
keyVariant—
Returns bool
HitTestint
# HitTest
C#
public int HitTest(Vector2 coords);

Returns caret character offset at the specified coordinates. This function always returns a valid position.

Parameters
NameTypeDefault
coordsVector2—
Returns int
ResizeObjectbool
# ResizeObject
C#
public bool ResizeObject(Variant key, Vector2 size, InlineAlignment inlineAlign = InlineAlignment.Center, float baseline = 0f);

Sets new size and alignment of embedded object.

Parameters
NameTypeDefault
keyVariant—
sizeVector2—
inlineAlignInlineAlignmentInlineAlignment.Center
baselinefloat0f
Returns bool
SetAlignmentvoid
# SetAlignment
C#
public void SetAlignment(HorizontalAlignment alignment);
Parameters
NameTypeDefault
alignmentHorizontalAlignment—
SetBidiOverridevoid
# SetBidiOverride
C#
public void SetBidiOverride(Reckfell.Collections.Array @override);

Overrides BiDi for the structured text. Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.

Parameters
NameTypeDefault
overrideReckfell.Collections.Array—
SetBreakFlagsvoid
# SetBreakFlags
C#
public void SetBreakFlags(TextServer.LineBreakFlag flags);
Parameters
NameTypeDefault
flagsTextServer.LineBreakFlag—
SetCustomPunctuationvoid
# SetCustomPunctuation
C#
public void SetCustomPunctuation(string customPunctuation);
Parameters
NameTypeDefault
customPunctuationstring—
SetDirectionvoid
# SetDirection
C#
public void SetDirection(TextServer.Direction direction);
Parameters
NameTypeDefault
directionTextServer.Direction—
SetDropcapbool
# SetDropcap
C#
public bool SetDropcap(string text, Font font, int fontSize, Rect2? dropcapMargins = default, string language = "");

Sets drop cap, overrides previously set drop cap. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.

Parameters
NameTypeDefault
textstring—
fontFont—
fontSizeint—
dropcapMarginsRect2?default
languagestring""
dropcapMargins

If the parameter is null, then the default value is new Rect2(new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f)).

Returns bool
SetEllipsisCharvoid
# SetEllipsisChar
C#
public void SetEllipsisChar(string @char);
Parameters
NameTypeDefault
charstring—
SetJustificationFlagsvoid
# SetJustificationFlags
C#
public void SetJustificationFlags(TextServer.JustificationFlag flags);
Parameters
NameTypeDefault
flagsTextServer.JustificationFlag—
SetLineSpacingvoid
# SetLineSpacing
C#
public void SetLineSpacing(float lineSpacing);
Parameters
NameTypeDefault
lineSpacingfloat—
SetMaxLinesVisiblevoid
# SetMaxLinesVisible
C#
public void SetMaxLinesVisible(int maxLinesVisible);
Parameters
NameTypeDefault
maxLinesVisibleint—
SetOrientationvoid
# SetOrientation
C#
public void SetOrientation(TextServer.Orientation orientation);
Parameters
NameTypeDefault
orientationTextServer.Orientation—
SetPreserveControlvoid
# SetPreserveControl
C#
public void SetPreserveControl(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetPreserveInvalidvoid
# SetPreserveInvalid
C#
public void SetPreserveInvalid(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetTextOverrunBehaviorvoid
# SetTextOverrunBehavior
C#
public void SetTextOverrunBehavior(TextServer.OverrunBehavior overrunBehavior);
Parameters
NameTypeDefault
overrunBehaviorTextServer.OverrunBehavior—
SetWidthvoid
# SetWidth
C#
public void SetWidth(float width);
Parameters
NameTypeDefault
widthfloat—
TabAlign2 overloads
# TabAlign · 1/2
C#
public void TabAlign(ReadOnlySpan<float> tabStops);

Aligns paragraph to the given tab-stops.

Parameters
NameTypeDefault
tabStopsReadOnlySpan<float>—
# TabAlign · 2/2
C#
public void TabAlign(float[] tabStops);

Aligns paragraph to the given tab-stops.

Parameters
NameTypeDefault
tabStopsfloat[]—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.