TextLine
Holds a line of text.
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
public TextLine();Properties9
AlignmentProperty
public HorizontalAlignment Alignment { get; set; }Sets text alignment within the line as if the line was horizontal.
DirectionProperty
public TextServer.Direction Direction { get; set; }Text writing direction.
EllipsisCharProperty
public string EllipsisChar { get; set; }Ellipsis character used for text clipping.
FlagsProperty
public TextServer.JustificationFlag Flags { get; set; }Line alignment rules. For more info see TextServer.
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 text line's set width.
WidthProperty
public float Width { get; set; }Text line width.
Methods42
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 line (removes text and inline objects).
Draw2 overloads
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.
| 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 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.
| 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).
DrawOutline2 overloads
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.
| 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 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.
| 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).
DuplicateTextLine
public TextLine Duplicate();Duplicates this TextLine.
TextLineGetDirectionTextServer.Direction
public TextServer.Direction GetDirection();TextServer.DirectionGetEllipsisCharstring
public string GetEllipsisChar();stringGetFlagsTextServer.JustificationFlag
public TextServer.JustificationFlag GetFlags();TextServer.JustificationFlagGetHorizontalAlignmentHorizontalAlignment
public HorizontalAlignment GetHorizontalAlignment();HorizontalAlignmentGetInferredDirectionTextServer.Direction
public TextServer.Direction GetInferredDirection();Returns the text writing direction inferred by the BiDi algorithm.
TextServer.DirectionGetLineAscentfloat
public float GetLineAscent();Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
floatGetLineDescentfloat
public float GetLineDescent();Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
floatGetLineUnderlinePositionfloat
public float GetLineUnderlinePosition();Returns pixel offset of the underline below the baseline.
floatGetLineUnderlineThicknessfloat
public float GetLineUnderlineThickness();Returns thickness of the underline.
floatGetLineWidthfloat
public float GetLineWidth();Returns width (for horizontal layout) or height (for vertical) of the text.
floatGetObjectRectRect2
public Rect2 GetObjectRect(Variant key);Returns bounding rectangle of the inline object.
| Name | Type | Default |
|---|---|---|
key | Variant | — |
Rect2GetObjectsReckfell.Collections.Array
public Reckfell.Collections.Array GetObjects();Returns array of inline objects.
Reckfell.Collections.ArrayGetOrientationTextServer.Orientation
public TextServer.Orientation GetOrientation();TextServer.OrientationGetPreserveControlbool
public bool GetPreserveControl();boolGetPreserveInvalidbool
public bool GetPreserveInvalid();boolGetRidRid
public Rid GetRid();Returns TextServer buffer RID.
RidGetSizeVector2
public Vector2 GetSize();Returns size of the bounding box of the text.
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 line.
| Name | Type | Default |
|---|---|---|
key | Variant | — |
boolHitTestint
public int HitTest(float coords);Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
| Name | Type | Default |
|---|---|---|
coords | float | — |
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 |
boolSetBidiOverridevoid
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 | — |
SetDirectionvoid
public void SetDirection(TextServer.Direction direction);| Name | Type | Default |
|---|---|---|
direction | TextServer.Direction | — |
SetEllipsisCharvoid
public void SetEllipsisChar(string @char);| Name | Type | Default |
|---|---|---|
char | string | — |
SetFlagsvoid
public void SetFlags(TextServer.JustificationFlag flags);| Name | Type | Default |
|---|---|---|
flags | TextServer.JustificationFlag | — |
SetHorizontalAlignmentvoid
public void SetHorizontalAlignment(HorizontalAlignment alignment);| Name | Type | Default |
|---|---|---|
alignment | HorizontalAlignment | — |
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 text to the given tab-stops.
| Name | Type | Default |
|---|---|---|
tabStops | ReadOnlySpan<float> | — |
public void TabAlign(float[] tabStops);Aligns text to the given tab-stops.
| Name | Type | Default |
|---|---|---|
tabStops | float[] | — |