TextParagraph
Holds a paragraph of text.
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
public TextParagraph();Properties13
AlignmentProperty
public HorizontalAlignment Alignment { get; set; }Paragraph horizontal alignment.
BreakFlagsProperty
public TextServer.LineBreakFlag BreakFlags { get; set; }Line breaking rules. For more info see TextServer.
CustomPunctuationProperty
public string CustomPunctuation { get; set; }Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
DirectionProperty
public TextServer.Direction Direction { get; set; }Text writing direction.
EllipsisCharProperty
public string EllipsisChar { get; set; }Ellipsis character used for text clipping.
JustificationFlagsProperty
public TextServer.JustificationFlag JustificationFlags { get; set; }Line fill alignment rules.
LineSpacingProperty
public float LineSpacing { get; set; }Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
MaxLinesVisibleProperty
public int MaxLinesVisible { get; set; }Limits the lines of text shown.
OrientationProperty
public TextServer.Orientation Orientation { get; set; }Text orientation.
PreserveControlProperty
public bool PreserveControl { get; set; }If set to true text will display control characters.
PreserveInvalidProperty
public bool PreserveInvalid { get; set; }If set to true text will display invalid characters.
TextOverrunBehaviorProperty
public TextServer.OverrunBehavior TextOverrunBehavior { get; set; }The clipping behavior when the text exceeds the paragraph's set width.
WidthProperty
public float Width { get; set; }Paragraph width.
Methods69
AddObjectbool
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.
| Name | Type | Default |
|---|---|---|
key | Variant | — |
size | Vector2 | — |
inlineAlign | InlineAlignment | InlineAlignment.Center |
length | int | 1 |
baseline | float | 0f |
boolAddStringbool
public bool AddString(string text, Font font, int fontSize, string language = "", Variant meta = default);Adds text span and font to draw it.
| Name | Type | Default |
|---|---|---|
text | string | — |
font | Font | — |
fontSize | int | — |
language | string | "" |
meta | Variant | default |
boolClearvoid
public void Clear();Clears text paragraph (removes text and inline objects).
ClearDropcapvoid
public void ClearDropcap();Removes dropcap.
Draw2 overloads
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
color | Color? | — |
dcColor | Color? | — |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
dcColorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
color | Color? | default |
dcColor | Color? | default |
oversampling | float | 0f |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
dcColorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
DrawDropcap2 overloads
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
color | Color? | — |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
color | Color? | default |
oversampling | float | 0f |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
DrawDropcapOutline2 overloads
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
outlineSize | int | — |
color | Color? | — |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
outlineSize | int | 1 |
color | Color? | default |
oversampling | float | 0f |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
DrawLine2 overloads
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
line | int | — |
color | Color? | — |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
line | int | — |
color | Color? | default |
oversampling | float | 0f |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
DrawLineOutline2 overloads
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
line | int | — |
outlineSize | int | — |
color | Color? | — |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
line | int | — |
outlineSize | int | 1 |
color | Color? | default |
oversampling | float | 0f |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
DrawOutline2 overloads
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
outlineSize | int | — |
color | Color? | — |
dcColor | Color? | — |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
dcColorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
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.
| Name | Type | Default |
|---|---|---|
canvas | Rid | — |
pos | Vector2 | — |
outlineSize | int | 1 |
color | Color? | default |
dcColor | Color? | default |
oversampling | float | 0f |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
dcColorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
DuplicateTextParagraph
public TextParagraph Duplicate();Duplicates this TextParagraph.
TextParagraphGetAlignmentHorizontalAlignment
public HorizontalAlignment GetAlignment();HorizontalAlignmentGetBreakFlagsTextServer.LineBreakFlag
public TextServer.LineBreakFlag GetBreakFlags();TextServer.LineBreakFlagGetCustomPunctuationstring
public string GetCustomPunctuation();stringGetDirectionTextServer.Direction
public TextServer.Direction GetDirection();TextServer.DirectionGetDropcapLinesint
public int GetDropcapLines();Returns number of lines used by dropcap.
intGetDropcapRidRid
public Rid GetDropcapRid();Returns drop cap text buffer RID.
RidGetDropcapSizeVector2
public Vector2 GetDropcapSize();Returns drop cap bounding box size.
Vector2GetEllipsisCharstring
public string GetEllipsisChar();stringGetInferredDirectionTextServer.Direction
public TextServer.Direction GetInferredDirection();Returns the text writing direction inferred by the BiDi algorithm.
TextServer.DirectionGetJustificationFlagsTextServer.JustificationFlag
public TextServer.JustificationFlag GetJustificationFlags();TextServer.JustificationFlagGetLineAscentfloat
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).
| Name | Type | Default |
|---|---|---|
line | int | — |
floatGetLineCountint
public int GetLineCount();Returns number of lines in the paragraph.
intGetLineDescentfloat
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).
| Name | Type | Default |
|---|---|---|
line | int | — |
floatGetLineObjectRectRect2
public Rect2 GetLineObjectRect(int line, Variant key);Returns bounding rectangle of the inline object.
| Name | Type | Default |
|---|---|---|
line | int | — |
key | Variant | — |
Rect2GetLineObjectsReckfell.Collections.Array
public Reckfell.Collections.Array GetLineObjects(int line);Returns array of inline objects in the line.
| Name | Type | Default |
|---|---|---|
line | int | — |
Reckfell.Collections.ArrayGetLineRangeVector2I
public Vector2I GetLineRange(int line);Returns character range of the line.
| Name | Type | Default |
|---|---|---|
line | int | — |
Vector2IGetLineRidRid
public Rid GetLineRid(int line);Returns TextServer line buffer RID.
| Name | Type | Default |
|---|---|---|
line | int | — |
RidGetLineSizeVector2
public Vector2 GetLineSize(int line);Returns size of the bounding box of the line of text. Returned size is rounded up.
| Name | Type | Default |
|---|---|---|
line | int | — |
Vector2GetLineSpacingfloat
public float GetLineSpacing();floatGetLineUnderlinePositionfloat
public float GetLineUnderlinePosition(int line);Returns pixel offset of the underline below the baseline.
| Name | Type | Default |
|---|---|---|
line | int | — |
floatGetLineUnderlineThicknessfloat
public float GetLineUnderlineThickness(int line);Returns thickness of the underline.
| Name | Type | Default |
|---|---|---|
line | int | — |
floatGetLineWidthfloat
public float GetLineWidth(int line);Returns width (for horizontal layout) or height (for vertical) of the line of text.
| Name | Type | Default |
|---|---|---|
line | int | — |
floatGetMaxLinesVisibleint
public int GetMaxLinesVisible();intGetNonWrappedSizeVector2
public Vector2 GetNonWrappedSize();Returns the size of the bounding box of the paragraph, without line breaks.
Vector2GetOrientationTextServer.Orientation
public TextServer.Orientation GetOrientation();TextServer.OrientationGetPreserveControlbool
public bool GetPreserveControl();boolGetPreserveInvalidbool
public bool GetPreserveInvalid();boolGetRangeVector2I
public Vector2I GetRange();Returns the character range of the paragraph.
Vector2IGetRidRid
public Rid GetRid();Returns TextServer full string buffer RID.
RidGetSizeVector2
public Vector2 GetSize();Returns the size of the bounding box of the paragraph.
Vector2GetTextOverrunBehaviorTextServer.OverrunBehavior
public TextServer.OverrunBehavior GetTextOverrunBehavior();TextServer.OverrunBehaviorGetWidthfloat
public float GetWidth();floatHasObjectbool
public bool HasObject(Variant key);Returns true if an object with key is embedded in this shaped text buffer.
| Name | Type | Default |
|---|---|---|
key | Variant | — |
boolHitTestint
public int HitTest(Vector2 coords);Returns caret character offset at the specified coordinates. This function always returns a valid position.
| Name | Type | Default |
|---|---|---|
coords | Vector2 | — |
intResizeObjectbool
public bool ResizeObject(Variant key, Vector2 size, InlineAlignment inlineAlign = InlineAlignment.Center, float baseline = 0f);Sets new size and alignment of embedded object.
| Name | Type | Default |
|---|---|---|
key | Variant | — |
size | Vector2 | — |
inlineAlign | InlineAlignment | InlineAlignment.Center |
baseline | float | 0f |
boolSetAlignmentvoid
public void SetAlignment(HorizontalAlignment alignment);| Name | Type | Default |
|---|---|---|
alignment | HorizontalAlignment | — |
SetBidiOverridevoid
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.
| Name | Type | Default |
|---|---|---|
override | Reckfell.Collections.Array | — |
SetBreakFlagsvoid
public void SetBreakFlags(TextServer.LineBreakFlag flags);| Name | Type | Default |
|---|---|---|
flags | TextServer.LineBreakFlag | — |
SetCustomPunctuationvoid
public void SetCustomPunctuation(string customPunctuation);| Name | Type | Default |
|---|---|---|
customPunctuation | string | — |
SetDirectionvoid
public void SetDirection(TextServer.Direction direction);| Name | Type | Default |
|---|---|---|
direction | TextServer.Direction | — |
SetDropcapbool
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.
| Name | Type | Default |
|---|---|---|
text | string | — |
font | Font | — |
fontSize | int | — |
dropcapMargins | Rect2? | default |
language | string | "" |
dropcapMarginsIf the parameter is null, then the default value is new Rect2(new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f)).
boolSetEllipsisCharvoid
public void SetEllipsisChar(string @char);| Name | Type | Default |
|---|---|---|
char | string | — |
SetJustificationFlagsvoid
public void SetJustificationFlags(TextServer.JustificationFlag flags);| Name | Type | Default |
|---|---|---|
flags | TextServer.JustificationFlag | — |
SetLineSpacingvoid
public void SetLineSpacing(float lineSpacing);| Name | Type | Default |
|---|---|---|
lineSpacing | float | — |
SetMaxLinesVisiblevoid
public void SetMaxLinesVisible(int maxLinesVisible);| Name | Type | Default |
|---|---|---|
maxLinesVisible | int | — |
SetOrientationvoid
public void SetOrientation(TextServer.Orientation orientation);| Name | Type | Default |
|---|---|---|
orientation | TextServer.Orientation | — |
SetPreserveControlvoid
public void SetPreserveControl(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetPreserveInvalidvoid
public void SetPreserveInvalid(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetTextOverrunBehaviorvoid
public void SetTextOverrunBehavior(TextServer.OverrunBehavior overrunBehavior);| Name | Type | Default |
|---|---|---|
overrunBehavior | TextServer.OverrunBehavior | — |
SetWidthvoid
public void SetWidth(float width);| Name | Type | Default |
|---|---|---|
width | float | — |
TabAlign2 overloads
public void TabAlign(ReadOnlySpan<float> tabStops);Aligns paragraph to the given tab-stops.
| Name | Type | Default |
|---|---|---|
tabStops | ReadOnlySpan<float> | — |
public void TabAlign(float[] tabStops);Aligns paragraph to the given tab-stops.
| Name | Type | Default |
|---|---|---|
tabStops | float[] | — |