Class TextLine
Holds a line of text.
- Inheritance
-
TextLine
Remarks
Abstraction over TextServer for handling a single line of text.
Properties
alignment
Sets text alignment within the line as if the line was horizontal.
var alignment : int = 0
Property Value
Remarks
direction
Text writing direction.
var direction : int = 0
Property Value
Remarks
ellipsis_char
Ellipsis character used for text clipping.
var ellipsis_char : String = "…"
Property Value
Remarks
flags
Line alignment rules. For more info see TextServer.
var flags : int = 3
Property Value
Remarks
orientation
Text orientation.
var orientation : int = 0
Property Value
Remarks
preserve_control
If set to true
text will display control characters.
var preserve_control : bool = false
Property Value
Remarks
preserve_invalid
If set to true
text will display invalid characters.
var preserve_invalid : bool = true
Property Value
Remarks
text_overrun_behavior
Sets the clipping behavior when the text exceeds the text line's set width. See OverrunBehavior for a description of all modes.
var text_overrun_behavior : int = 3
Property Value
Remarks
width
Text line width.
var width : float = -1.0
Property Value
Remarks
Methods
add_object(Variant, Vector2, int, int, float)
Adds inline object to the text buffer, key
must be unique. In the text, object is represented as length
object replacement characters.
bool add_object(Variant key, Vector2 size, int inline_align, int length, float baseline)
Parameters
add_string(String, Font, int, String, Variant)
Adds text span and font to draw it.
bool add_string(String text, Font font, int font_size, String language, Variant meta)
Parameters
clear
Clears text line (removes text and inline objects).
void clear
draw(RID, Vector2, Color)
Qualifiers: const
Draw text into a canvas item at a given position, with color
. pos
specifies the top left corner of the bounding box.
void draw(RID canvas, Vector2 pos, Color color)
Parameters
draw_outline(RID, Vector2, int, Color)
Qualifiers: const
Draw text into a canvas item at a given position, with color
. pos
specifies the top left corner of the bounding box.
void draw_outline(RID canvas, Vector2 pos, int outline_size, Color color)
Parameters
get_line_ascent
Qualifiers: const
Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
float get_line_ascent
get_line_descent
Qualifiers: const
Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
float get_line_descent
get_line_underline_position
Qualifiers: const
Returns pixel offset of the underline below the baseline.
float get_line_underline_position
get_line_underline_thickness
Qualifiers: const
Returns thickness of the underline.
float get_line_underline_thickness
get_line_width
Qualifiers: const
Returns width (for horizontal layout) or height (for vertical) of the text.
float get_line_width
get_object_rect(Variant)
Qualifiers: const
Returns bounding rectangle of the inline object.
Rect2 get_object_rect(Variant key)
Parameters
key
Variant
get_objects
Qualifiers: const
Returns array of inline objects.
Array get_objects
get_rid
Qualifiers: const
Returns TextServer buffer RID.
RID get_rid
get_size
Qualifiers: const
Returns size of the bounding box of the text.
Vector2 get_size
hit_test(float)
Qualifiers: const
Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
int hit_test(float coords)
Parameters
coords
float
resize_object(Variant, Vector2, int, float)
Sets new size and alignment of embedded object.
bool resize_object(Variant key, Vector2 size, int inline_align, float baseline)
Parameters
set_bidi_override(Array)
Overrides BiDi for the structured text.
Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
void set_bidi_override(Array override)
Parameters
override
Array
tab_align(PackedFloat32Array)
Aligns text to the given tab-stops.
void tab_align(PackedFloat32Array tab_stops)
Parameters
tab_stops
PackedFloat32Array