2020-08-12 11:49:10 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 00:44:37 +00:00
<class name= "TextParagraph" inherits= "RefCounted" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2020-08-12 11:49:10 +00:00
<brief_description >
Holds a paragraph of text.
</brief_description>
<description >
2023-04-30 14:26:09 +00:00
Abstraction over [TextServer] for handling a single paragraph of text.
2020-08-12 11:49:10 +00:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "add_object" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "key" type= "Variant" />
<param index= "1" name= "size" type= "Vector2" />
<param index= "2" name= "inline_align" type= "int" enum= "InlineAlignment" default= "5" />
<param index= "3" name= "length" type= "int" default= "1" />
2022-12-08 20:01:07 +00:00
<param index= "4" name= "baseline" type= "float" default= "0.0" />
2020-08-12 11:49:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Adds inline object to the text buffer, [param key] must be unique. In the text, object is represented as [param length] object replacement characters.
2020-08-12 11:49:10 +00:00
</description>
</method>
<method name= "add_string" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "text" type= "String" />
<param index= "1" name= "font" type= "Font" />
<param index= "2" name= "font_size" type= "int" />
<param index= "3" name= "language" type= "String" default= """" />
<param index= "4" name= "meta" type= "Variant" default= "null" />
2020-08-12 11:49:10 +00:00
<description >
Adds text span and font to draw it.
</description>
</method>
<method name= "clear" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2020-08-12 11:49:10 +00:00
<description >
Clears text paragraph (removes text and inline objects).
</description>
</method>
2020-11-19 14:45:23 +00:00
<method name= "clear_dropcap" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2020-11-19 14:45:23 +00:00
<description >
Removes dropcap.
</description>
</method>
2020-08-12 11:49:10 +00:00
<method name= "draw" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas" type= "RID" />
<param index= "1" name= "pos" type= "Vector2" />
<param index= "2" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
<param index= "3" name= "dc_color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-08-12 11:49:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Draw all lines of the text and drop cap into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
2020-11-19 14:45:23 +00:00
</description>
</method>
<method name= "draw_dropcap" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas" type= "RID" />
<param index= "1" name= "pos" type= "Vector2" />
<param index= "2" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-11-19 14:45:23 +00:00
<description >
2022-08-09 15:19:47 +00:00
Draw drop cap into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
2020-11-19 14:45:23 +00:00
</description>
</method>
<method name= "draw_dropcap_outline" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas" type= "RID" />
<param index= "1" name= "pos" type= "Vector2" />
<param index= "2" name= "outline_size" type= "int" default= "1" />
<param index= "3" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-11-19 14:45:23 +00:00
<description >
2022-08-09 15:19:47 +00:00
Draw drop cap outline into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
2020-08-12 11:49:10 +00:00
</description>
</method>
<method name= "draw_line" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas" type= "RID" />
<param index= "1" name= "pos" type= "Vector2" />
<param index= "2" name= "line" type= "int" />
<param index= "3" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-08-12 11:49:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Draw single line of text into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
2020-08-12 11:49:10 +00:00
</description>
</method>
<method name= "draw_line_outline" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas" type= "RID" />
<param index= "1" name= "pos" type= "Vector2" />
<param index= "2" name= "line" type= "int" />
<param index= "3" name= "outline_size" type= "int" default= "1" />
<param index= "4" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-08-12 11:49:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Draw outline of the single line of text into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
2020-08-12 11:49:10 +00:00
</description>
</method>
<method name= "draw_outline" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "canvas" type= "RID" />
<param index= "1" name= "pos" type= "Vector2" />
<param index= "2" name= "outline_size" type= "int" default= "1" />
<param index= "3" name= "color" type= "Color" default= "Color(1, 1, 1, 1)" />
<param index= "4" name= "dc_color" type= "Color" default= "Color(1, 1, 1, 1)" />
2020-08-12 11:49:10 +00:00
<description >
2022-08-09 15:19:47 +00:00
Draw outlines of all lines of the text and drop cap into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
2020-11-19 14:45:23 +00:00
</description>
</method>
<method name= "get_dropcap_lines" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2020-11-19 14:45:23 +00:00
<description >
Returns number of lines used by dropcap.
</description>
</method>
<method name= "get_dropcap_rid" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "RID" />
2020-11-19 14:45:23 +00:00
<description >
2022-01-02 17:32:49 +00:00
Returns drop cap text buffer RID.
2020-11-19 14:45:23 +00:00
</description>
</method>
<method name= "get_dropcap_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2020-11-19 14:45:23 +00:00
<description >
Returns drop cap bounding box size.
2020-08-12 11:49:10 +00:00
</description>
</method>
<method name= "get_line_ascent" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
</description>
</method>
<method name= "get_line_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns number of lines in the paragraph.
</description>
</method>
<method name= "get_line_descent" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
</description>
</method>
<method name= "get_line_object_rect" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Rect2" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
<param index= "1" name= "key" type= "Variant" />
2020-08-12 11:49:10 +00:00
<description >
Returns bounding rectangle of the inline object.
</description>
</method>
<method name= "get_line_objects" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Array" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns array of inline objects in the line.
</description>
</method>
<method name= "get_line_range" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2i" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns character range of the line.
</description>
</method>
<method name= "get_line_rid" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "RID" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns TextServer line buffer RID.
</description>
</method>
<method name= "get_line_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns size of the bounding box of the line of text.
</description>
</method>
<method name= "get_line_underline_position" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns pixel offset of the underline below the baseline.
</description>
</method>
<method name= "get_line_underline_thickness" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns thickness of the underline.
</description>
</method>
<method name= "get_line_width" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns width (for horizontal layout) or height (for vertical) of the line of text.
</description>
</method>
2021-10-19 19:38:58 +00:00
<method name= "get_non_wrapped_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2020-08-12 11:49:10 +00:00
<description >
Returns the size of the bounding box of the paragraph, without line breaks.
</description>
</method>
<method name= "get_rid" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "RID" />
2020-08-12 11:49:10 +00:00
<description >
Returns TextServer full string buffer RID.
</description>
</method>
<method name= "get_size" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2020-08-12 11:49:10 +00:00
<description >
Returns the size of the bounding box of the paragraph.
</description>
</method>
<method name= "hit_test" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "coords" type= "Vector2" />
2020-08-12 11:49:10 +00:00
<description >
Returns caret character offset at the specified coordinates. This function always returns a valid position.
</description>
</method>
<method name= "resize_object" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "key" type= "Variant" />
<param index= "1" name= "size" type= "Vector2" />
<param index= "2" name= "inline_align" type= "int" enum= "InlineAlignment" default= "5" />
2022-12-08 20:01:07 +00:00
<param index= "3" name= "baseline" type= "float" default= "0.0" />
2020-08-12 11:49:10 +00:00
<description >
Sets new size and alignment of embedded object.
</description>
</method>
<method name= "set_bidi_override" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "override" type= "Array" />
2020-08-12 11:49:10 +00: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>
2020-11-19 14:45:23 +00:00
<method name= "set_dropcap" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "text" type= "String" />
<param index= "1" name= "font" type= "Font" />
<param index= "2" name= "font_size" type= "int" />
<param index= "3" name= "dropcap_margins" type= "Rect2" default= "Rect2(0, 0, 0, 0)" />
<param index= "4" name= "language" type= "String" default= """" />
2020-11-19 14:45:23 +00:00
<description >
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.
</description>
</method>
2020-08-12 11:49:10 +00:00
<method name= "tab_align" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "tab_stops" type= "PackedFloat32Array" />
2020-08-12 11:49:10 +00:00
<description >
Aligns paragraph to the given tab-stops.
</description>
</method>
</methods>
<members >
2021-11-25 02:58:47 +00:00
<member name= "alignment" type= "int" setter= "set_alignment" getter= "get_alignment" enum= "HorizontalAlignment" default= "0" >
2020-08-12 11:49:10 +00:00
Paragraph horizontal alignment.
</member>
2022-07-11 09:40:31 +00:00
<member name= "break_flags" type= "int" setter= "set_break_flags" getter= "get_break_flags" enum= "TextServer.LineBreakFlag" default= "3" >
Line breaking rules. For more info see [TextServer].
</member>
2021-03-06 09:52:16 +00:00
<member name= "custom_punctuation" type= "String" setter= "set_custom_punctuation" getter= "get_custom_punctuation" default= """" >
Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
</member>
2020-08-12 11:49:10 +00:00
<member name= "direction" type= "int" setter= "set_direction" getter= "get_direction" enum= "TextServer.Direction" default= "0" >
Text writing direction.
</member>
2023-03-23 09:22:37 +00:00
<member name= "justification_flags" type= "int" setter= "set_justification_flags" getter= "get_justification_flags" enum= "TextServer.JustificationFlag" default= "163" >
Line fill alignment rules. For more info see [enum TextServer.JustificationFlag].
2020-08-12 11:49:10 +00:00
</member>
2021-08-10 22:09:48 +00:00
<member name= "max_lines_visible" type= "int" setter= "set_max_lines_visible" getter= "get_max_lines_visible" default= "-1" >
Limits the lines of text shown.
</member>
2020-08-12 11:49:10 +00:00
<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 08:01:45 +00:00
<member name= "text_overrun_behavior" type= "int" setter= "set_text_overrun_behavior" getter= "get_text_overrun_behavior" enum= "TextServer.OverrunBehavior" default= "0" >
Sets the clipping behavior when the text exceeds the paragraph's set width. See [enum TextServer.OverrunBehavior] for a description of all modes.
2021-08-10 22:09:48 +00:00
</member>
2020-08-12 11:49:10 +00:00
<member name= "width" type= "float" setter= "set_width" getter= "get_width" default= "-1.0" >
Paragraph width.
</member>
</members>
</class>