reckfellENGINE

TextLine

Holds a line of text.

On this page
class TextLineReckfellSharpInherits RefCounted

Holds a line of text.

Abstraction over TextServer for handling a single line of text.

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

Constructors1

TextLineConstructor
# TextLine
C#
public TextLine();

Properties9

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

Sets text alignment within the line as if the line was horizontal.

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.

FlagsProperty
# Flags
C#
public TextServer.JustificationFlag Flags { get; set; }

Line alignment rules. For more info see TextServer.

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 text line's set width.

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

Text line width.

Methods42

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 line (removes text and inline objects).

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

Draw 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—
colorColor?—
color

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, float oversampling = 0f);

Draw 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—
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);

Draw 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—
outlineSizeint—
colorColor?—
color

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, float oversampling = 0f);

Draw 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—
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).

DuplicateTextLine
# Duplicate
C#
public TextLine Duplicate();

Duplicates this TextLine.

Returns TextLine
GetDirectionTextServer.Direction
# GetDirection
C#
public TextServer.Direction GetDirection();
Returns TextServer.Direction
GetEllipsisCharstring
# GetEllipsisChar
C#
public string GetEllipsisChar();
Returns string
GetFlagsTextServer.JustificationFlag
# GetFlags
C#
public TextServer.JustificationFlag GetFlags();
Returns TextServer.JustificationFlag
GetHorizontalAlignmentHorizontalAlignment
# GetHorizontalAlignment
C#
public HorizontalAlignment GetHorizontalAlignment();
Returns HorizontalAlignment
GetInferredDirectionTextServer.Direction
# GetInferredDirection
C#
public TextServer.Direction GetInferredDirection();

Returns the text writing direction inferred by the BiDi algorithm.

Returns TextServer.Direction
GetLineAscentfloat
# GetLineAscent
C#
public float GetLineAscent();

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

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

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

Returns float
GetLineUnderlinePositionfloat
# GetLineUnderlinePosition
C#
public float GetLineUnderlinePosition();

Returns pixel offset of the underline below the baseline.

Returns float
GetLineUnderlineThicknessfloat
# GetLineUnderlineThickness
C#
public float GetLineUnderlineThickness();

Returns thickness of the underline.

Returns float
GetLineWidthfloat
# GetLineWidth
C#
public float GetLineWidth();

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

Returns float
GetObjectRectRect2
# GetObjectRect
C#
public Rect2 GetObjectRect(Variant key);

Returns bounding rectangle of the inline object.

Parameters
NameTypeDefault
keyVariant—
Returns Rect2
GetObjectsReckfell.Collections.Array
# GetObjects
C#
public Reckfell.Collections.Array GetObjects();

Returns array of inline objects.

Returns Reckfell.Collections.Array
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
GetRidRid
# GetRid
C#
public Rid GetRid();

Returns TextServer buffer RID.

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

Returns size of the bounding box of the text.

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 line.

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

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

Parameters
NameTypeDefault
coordsfloat—
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
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—
SetDirectionvoid
# SetDirection
C#
public void SetDirection(TextServer.Direction direction);
Parameters
NameTypeDefault
directionTextServer.Direction—
SetEllipsisCharvoid
# SetEllipsisChar
C#
public void SetEllipsisChar(string @char);
Parameters
NameTypeDefault
charstring—
SetFlagsvoid
# SetFlags
C#
public void SetFlags(TextServer.JustificationFlag flags);
Parameters
NameTypeDefault
flagsTextServer.JustificationFlag—
SetHorizontalAlignmentvoid
# SetHorizontalAlignment
C#
public void SetHorizontalAlignment(HorizontalAlignment alignment);
Parameters
NameTypeDefault
alignmentHorizontalAlignment—
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 text to the given tab-stops.

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

Aligns text 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.