2020-08-12 13:49:10 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 14:18:53 +01:00
<class name= "TextLine" inherits= "RefCounted" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2020-08-12 13:49:10 +02:00
<brief_description >
Holds a line of text.
</brief_description>
<description >
Abstraction over [TextServer] for handling single line of text.
</description>
<tutorials >
</tutorials>
<methods >
<method name= "add_object" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
<argument index= "0" name= "key" type= "Variant" />
<argument index= "1" name= "size" type= "Vector2" />
2021-11-25 03:58:47 +01:00
<argument index= "2" name= "inline_align" type= "int" enum= "InlineAlignment" default= "5" />
2021-07-30 15:28:05 +02:00
<argument index= "3" name= "length" type= "int" default= "1" />
2020-08-12 13:49:10 +02:00
<description >
Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
</description>
</method>
<method name= "add_string" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
<argument index= "0" name= "text" type= "String" />
<argument index= "1" name= "fonts" type= "Font" />
<argument index= "2" name= "size" type= "int" />
2022-01-18 11:31:15 +01:00
<argument index= "3" name= "opentype_features" type= "Dictionary" default= "{}" />
2021-07-30 15:28:05 +02:00
<argument index= "4" name= "language" type= "String" default= """" />
2022-01-20 08:30:42 +01:00
<argument index= "5" name= "meta" type= "Variant" default= "null" />
2020-08-12 13:49:10 +02:00
<description >
Adds text span and font to draw it.
</description>
</method>
<method name= "clear" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2020-08-12 13:49:10 +02:00
<description >
Clears text line (removes text and inline objects).
</description>
</method>
<method name= "draw" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
<argument index= "0" name= "canvas" type= "RID" />
<argument index= "1" name= "pos" type= "Vector2" />
<argument index= "2" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-08-12 13:49:10 +02:00
<description >
Draw text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box.
</description>
</method>
<method name= "draw_outline" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
<argument index= "0" name= "canvas" type= "RID" />
<argument index= "1" name= "pos" type= "Vector2" />
<argument index= "2" name= "outline_size" type= "int" default= "1" />
<argument index= "3" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-08-12 13:49:10 +02:00
<description >
Draw text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box.
</description>
</method>
<method name= "get_line_ascent" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2020-08-12 13:49:10 +02:00
<description >
Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
</description>
</method>
<method name= "get_line_descent" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2020-08-12 13:49:10 +02:00
<description >
Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
</description>
</method>
<method name= "get_line_underline_position" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2020-08-12 13:49:10 +02:00
<description >
Returns pixel offset of the underline below the baseline.
</description>
</method>
<method name= "get_line_underline_thickness" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2020-08-12 13:49:10 +02:00
<description >
Returns thickness of the underline.
</description>
</method>
<method name= "get_line_width" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "float" />
2020-08-12 13:49:10 +02:00
<description >
Returns width (for horizontal layout) or height (for vertical) of the text.
</description>
</method>
<method name= "get_object_rect" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Rect2" />
<argument index= "0" name= "key" type= "Variant" />
2020-08-12 13:49:10 +02:00
<description >
Returns bounding rectangle of the inline object.
</description>
</method>
<method name= "get_objects" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Array" />
2020-08-12 13:49:10 +02:00
<description >
Returns array of inline objects.
</description>
</method>
<method name= "get_rid" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "RID" />
2020-08-12 13:49:10 +02:00
<description >
Returns TextServer buffer RID.
</description>
</method>
<method name= "get_size" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Vector2" />
2020-08-12 13:49:10 +02:00
<description >
Returns size of the bounding box of the text.
</description>
</method>
<method name= "hit_test" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
<argument index= "0" name= "coords" type= "float" />
2020-08-12 13:49:10 +02:00
<description >
Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
</description>
</method>
<method name= "resize_object" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
<argument index= "0" name= "key" type= "Variant" />
<argument index= "1" name= "size" type= "Vector2" />
2021-11-25 03:58:47 +01:00
<argument index= "2" name= "inline_align" type= "int" enum= "InlineAlignment" default= "5" />
2020-08-12 13:49:10 +02:00
<description >
Sets new size and alignment of embedded object.
</description>
</method>
<method name= "set_bidi_override" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
<argument index= "0" name= "override" type= "Array" />
2020-08-12 13:49:10 +02:00
<description >
Overrides BiDi for the structured text.
Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
</description>
</method>
<method name= "tab_align" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
<argument index= "0" name= "tab_stops" type= "PackedFloat32Array" />
2020-08-12 13:49:10 +02:00
<description >
Aligns text to the given tab-stops.
</description>
</method>
</methods>
<members >
2021-11-25 03:58:47 +01:00
<member name= "alignment" type= "int" setter= "set_horizontal_alignment" getter= "get_horizontal_alignment" enum= "HorizontalAlignment" default= "0" >
2020-08-12 13:49:10 +02:00
</member>
<member name= "direction" type= "int" setter= "set_direction" getter= "get_direction" enum= "TextServer.Direction" default= "0" >
Text writing direction.
</member>
<member name= "flags" type= "int" setter= "set_flags" getter= "get_flags" default= "3" >
Line Alignment rules. For more info see [TextServer].
</member>
<member name= "orientation" type= "int" setter= "set_orientation" getter= "get_orientation" enum= "TextServer.Orientation" default= "0" >
Text orientation.
</member>
<member name= "preserve_control" type= "bool" setter= "set_preserve_control" getter= "get_preserve_control" default= "false" >
If set to [code]true[/code] text will display control characters.
</member>
<member name= "preserve_invalid" type= "bool" setter= "set_preserve_invalid" getter= "get_preserve_invalid" default= "true" >
If set to [code]true[/code] text will display invalid characters.
</member>
2022-06-15 10:01:45 +02:00
<member name= "text_overrun_behavior" type= "int" setter= "set_text_overrun_behavior" getter= "get_text_overrun_behavior" enum= "TextServer.OverrunBehavior" default= "3" >
Sets the clipping behavior when the text exceeds the text line's set width. See [enum TextServer.OverrunBehavior] for a description of all modes.
2021-08-11 00:09:48 +02:00
</member>
2020-08-12 13:49:10 +02:00
<member name= "width" type= "float" setter= "set_width" getter= "get_width" default= "-1.0" >
Text line width.
</member>
</members>
</class>