| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="TextParagraph" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Holds a paragraph of text. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Abstraction over [TextServer] for handling a single paragraph of text. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | </tutorials> |
| 11 | <methods> |
| 12 | <method name="add_object"> |
| 13 | <return type="bool" /> |
| 14 | <param index="0" name="key" type="Variant" /> |
| 15 | <param index="1" name="size" type="Vector2" /> |
| 16 | <param index="2" name="inline_align" type="int" enum="InlineAlignment" default="5" /> |
| 17 | <param index="3" name="length" type="int" default="1" /> |
| 18 | <param index="4" name="baseline" type="float" default="0.0" /> |
| 19 | <description> |
| 20 | Adds inline object to the text buffer, [param key] must be unique. In the text, object is represented as [param length] object replacement characters. |
| 21 | </description> |
| 22 | </method> |
| 23 | <method name="add_string"> |
| 24 | <return type="bool" /> |
| 25 | <param index="0" name="text" type="String" /> |
| 26 | <param index="1" name="font" type="Font" /> |
| 27 | <param index="2" name="font_size" type="int" /> |
| 28 | <param index="3" name="language" type="String" default="""" /> |
| 29 | <param index="4" name="meta" type="Variant" default="null" /> |
| 30 | <description> |
| 31 | Adds text span and font to draw it. |
| 32 | </description> |
| 33 | </method> |
| 34 | <method name="clear"> |
| 35 | <return type="void" /> |
| 36 | <description> |
| 37 | Clears text paragraph (removes text and inline objects). |
| 38 | </description> |
| 39 | </method> |
| 40 | <method name="clear_dropcap"> |
| 41 | <return type="void" /> |
| 42 | <description> |
| 43 | Removes dropcap. |
| 44 | </description> |
| 45 | </method> |
| 46 | <method name="draw" qualifiers="const"> |
| 47 | <return type="void" /> |
| 48 | <param index="0" name="canvas" type="RID" /> |
| 49 | <param index="1" name="pos" type="Vector2" /> |
| 50 | <param index="2" name="color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 51 | <param index="3" name="dc_color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 52 | <param index="4" name="oversampling" type="float" default="0.0" /> |
| 53 | <description> |
| 54 | 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. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. |
| 55 | </description> |
| 56 | </method> |
| 57 | <method name="draw_dropcap" qualifiers="const"> |
| 58 | <return type="void" /> |
| 59 | <param index="0" name="canvas" type="RID" /> |
| 60 | <param index="1" name="pos" type="Vector2" /> |
| 61 | <param index="2" name="color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 62 | <param index="3" name="oversampling" type="float" default="0.0" /> |
| 63 | <description> |
| 64 | 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. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. |
| 65 | </description> |
| 66 | </method> |
| 67 | <method name="draw_dropcap_outline" qualifiers="const"> |
| 68 | <return type="void" /> |
| 69 | <param index="0" name="canvas" type="RID" /> |
| 70 | <param index="1" name="pos" type="Vector2" /> |
| 71 | <param index="2" name="outline_size" type="int" default="1" /> |
| 72 | <param index="3" name="color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 73 | <param index="4" name="oversampling" type="float" default="0.0" /> |
| 74 | <description> |
| 75 | 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. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. |
| 76 | </description> |
| 77 | </method> |
| 78 | <method name="draw_line" qualifiers="const"> |
| 79 | <return type="void" /> |
| 80 | <param index="0" name="canvas" type="RID" /> |
| 81 | <param index="1" name="pos" type="Vector2" /> |
| 82 | <param index="2" name="line" type="int" /> |
| 83 | <param index="3" name="color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 84 | <param index="4" name="oversampling" type="float" default="0.0" /> |
| 85 | <description> |
| 86 | 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. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. |
| 87 | </description> |
| 88 | </method> |
| 89 | <method name="draw_line_outline" qualifiers="const"> |
| 90 | <return type="void" /> |
| 91 | <param index="0" name="canvas" type="RID" /> |
| 92 | <param index="1" name="pos" type="Vector2" /> |
| 93 | <param index="2" name="line" type="int" /> |
| 94 | <param index="3" name="outline_size" type="int" default="1" /> |
| 95 | <param index="4" name="color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 96 | <param index="5" name="oversampling" type="float" default="0.0" /> |
| 97 | <description> |
| 98 | 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. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. |
| 99 | </description> |
| 100 | </method> |
| 101 | <method name="draw_outline" qualifiers="const"> |
| 102 | <return type="void" /> |
| 103 | <param index="0" name="canvas" type="RID" /> |
| 104 | <param index="1" name="pos" type="Vector2" /> |
| 105 | <param index="2" name="outline_size" type="int" default="1" /> |
| 106 | <param index="3" name="color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 107 | <param index="4" name="dc_color" type="Color" default="Color(1, 1, 1, 1)" /> |
| 108 | <param index="5" name="oversampling" type="float" default="0.0" /> |
| 109 | <description> |
| 110 | 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. If [param oversampling] is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used. |
| 111 | </description> |
| 112 | </method> |
| 113 | <method name="duplicate" qualifiers="const"> |
| 114 | <return type="TextParagraph" /> |
| 115 | <description> |
| 116 | Duplicates this [TextParagraph]. |
| 117 | </description> |
| 118 | </method> |
| 119 | <method name="get_dropcap_lines" qualifiers="const"> |
| 120 | <return type="int" /> |
| 121 | <description> |
| 122 | Returns number of lines used by dropcap. |
| 123 | </description> |
| 124 | </method> |
| 125 | <method name="get_dropcap_rid" qualifiers="const"> |
| 126 | <return type="RID" /> |
| 127 | <description> |
| 128 | Returns drop cap text buffer RID. |
| 129 | </description> |
| 130 | </method> |
| 131 | <method name="get_dropcap_size" qualifiers="const"> |
| 132 | <return type="Vector2" /> |
| 133 | <description> |
| 134 | Returns drop cap bounding box size. |
| 135 | </description> |
| 136 | </method> |
| 137 | <method name="get_inferred_direction" qualifiers="const"> |
| 138 | <return type="int" enum="TextServer.Direction" /> |
| 139 | <description> |
| 140 | Returns the text writing direction inferred by the BiDi algorithm. |
| 141 | </description> |
| 142 | </method> |
| 143 | <method name="get_line_ascent" qualifiers="const"> |
| 144 | <return type="float" /> |
| 145 | <param index="0" name="line" type="int" /> |
| 146 | <description> |
| 147 | Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). |
| 148 | </description> |
| 149 | </method> |
| 150 | <method name="get_line_count" qualifiers="const"> |
| 151 | <return type="int" /> |
| 152 | <description> |
| 153 | Returns number of lines in the paragraph. |
| 154 | </description> |
| 155 | </method> |
| 156 | <method name="get_line_descent" qualifiers="const"> |
| 157 | <return type="float" /> |
| 158 | <param index="0" name="line" type="int" /> |
| 159 | <description> |
| 160 | Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). |
| 161 | </description> |
| 162 | </method> |
| 163 | <method name="get_line_object_rect" qualifiers="const"> |
| 164 | <return type="Rect2" /> |
| 165 | <param index="0" name="line" type="int" /> |
| 166 | <param index="1" name="key" type="Variant" /> |
| 167 | <description> |
| 168 | Returns bounding rectangle of the inline object. |
| 169 | </description> |
| 170 | </method> |
| 171 | <method name="get_line_objects" qualifiers="const"> |
| 172 | <return type="Array" /> |
| 173 | <param index="0" name="line" type="int" /> |
| 174 | <description> |
| 175 | Returns array of inline objects in the line. |
| 176 | </description> |
| 177 | </method> |
| 178 | <method name="get_line_range" qualifiers="const"> |
| 179 | <return type="Vector2i" /> |
| 180 | <param index="0" name="line" type="int" /> |
| 181 | <description> |
| 182 | Returns character range of the line. |
| 183 | </description> |
| 184 | </method> |
| 185 | <method name="get_line_rid" qualifiers="const"> |
| 186 | <return type="RID" /> |
| 187 | <param index="0" name="line" type="int" /> |
| 188 | <description> |
| 189 | Returns TextServer line buffer RID. |
| 190 | </description> |
| 191 | </method> |
| 192 | <method name="get_line_size" qualifiers="const"> |
| 193 | <return type="Vector2" /> |
| 194 | <param index="0" name="line" type="int" /> |
| 195 | <description> |
| 196 | Returns size of the bounding box of the line of text. Returned size is rounded up. |
| 197 | </description> |
| 198 | </method> |
| 199 | <method name="get_line_underline_position" qualifiers="const"> |
| 200 | <return type="float" /> |
| 201 | <param index="0" name="line" type="int" /> |
| 202 | <description> |
| 203 | Returns pixel offset of the underline below the baseline. |
| 204 | </description> |
| 205 | </method> |
| 206 | <method name="get_line_underline_thickness" qualifiers="const"> |
| 207 | <return type="float" /> |
| 208 | <param index="0" name="line" type="int" /> |
| 209 | <description> |
| 210 | Returns thickness of the underline. |
| 211 | </description> |
| 212 | </method> |
| 213 | <method name="get_line_width" qualifiers="const"> |
| 214 | <return type="float" /> |
| 215 | <param index="0" name="line" type="int" /> |
| 216 | <description> |
| 217 | Returns width (for horizontal layout) or height (for vertical) of the line of text. |
| 218 | </description> |
| 219 | </method> |
| 220 | <method name="get_non_wrapped_size" qualifiers="const"> |
| 221 | <return type="Vector2" /> |
| 222 | <description> |
| 223 | Returns the size of the bounding box of the paragraph, without line breaks. |
| 224 | </description> |
| 225 | </method> |
| 226 | <method name="get_range" qualifiers="const"> |
| 227 | <return type="Vector2i" /> |
| 228 | <description> |
| 229 | Returns the character range of the paragraph. |
| 230 | </description> |
| 231 | </method> |
| 232 | <method name="get_rid" qualifiers="const"> |
| 233 | <return type="RID" /> |
| 234 | <description> |
| 235 | Returns TextServer full string buffer RID. |
| 236 | </description> |
| 237 | </method> |
| 238 | <method name="get_size" qualifiers="const"> |
| 239 | <return type="Vector2" /> |
| 240 | <description> |
| 241 | Returns the size of the bounding box of the paragraph. |
| 242 | </description> |
| 243 | </method> |
| 244 | <method name="has_object" qualifiers="const"> |
| 245 | <return type="bool" /> |
| 246 | <param index="0" name="key" type="Variant" /> |
| 247 | <description> |
| 248 | Returns [code]true[/code] if an object with [param key] is embedded in this shaped text buffer. |
| 249 | </description> |
| 250 | </method> |
| 251 | <method name="hit_test" qualifiers="const"> |
| 252 | <return type="int" /> |
| 253 | <param index="0" name="coords" type="Vector2" /> |
| 254 | <description> |
| 255 | Returns caret character offset at the specified coordinates. This function always returns a valid position. |
| 256 | </description> |
| 257 | </method> |
| 258 | <method name="resize_object"> |
| 259 | <return type="bool" /> |
| 260 | <param index="0" name="key" type="Variant" /> |
| 261 | <param index="1" name="size" type="Vector2" /> |
| 262 | <param index="2" name="inline_align" type="int" enum="InlineAlignment" default="5" /> |
| 263 | <param index="3" name="baseline" type="float" default="0.0" /> |
| 264 | <description> |
| 265 | Sets new size and alignment of embedded object. |
| 266 | </description> |
| 267 | </method> |
| 268 | <method name="set_bidi_override"> |
| 269 | <return type="void" /> |
| 270 | <param index="0" name="override" type="Array" /> |
| 271 | <description> |
| 272 | Overrides BiDi for the structured text. |
| 273 | Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately. |
| 274 | </description> |
| 275 | </method> |
| 276 | <method name="set_dropcap"> |
| 277 | <return type="bool" /> |
| 278 | <param index="0" name="text" type="String" /> |
| 279 | <param index="1" name="font" type="Font" /> |
| 280 | <param index="2" name="font_size" type="int" /> |
| 281 | <param index="3" name="dropcap_margins" type="Rect2" default="Rect2(0, 0, 0, 0)" /> |
| 282 | <param index="4" name="language" type="String" default="""" /> |
| 283 | <description> |
| 284 | 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. |
| 285 | </description> |
| 286 | </method> |
| 287 | <method name="tab_align"> |
| 288 | <return type="void" /> |
| 289 | <param index="0" name="tab_stops" type="PackedFloat32Array" /> |
| 290 | <description> |
| 291 | Aligns paragraph to the given tab-stops. |
| 292 | </description> |
| 293 | </method> |
| 294 | </methods> |
| 295 | <members> |
| 296 | <member name="alignment" type="int" setter="set_alignment" getter="get_alignment" enum="HorizontalAlignment" default="0"> |
| 297 | Paragraph horizontal alignment. |
| 298 | </member> |
| 299 | <member name="break_flags" type="int" setter="set_break_flags" getter="get_break_flags" enum="TextServer.LineBreakFlag" is_bitfield="true" default="3"> |
| 300 | Line breaking rules. For more info see [TextServer]. |
| 301 | </member> |
| 302 | <member name="custom_punctuation" type="String" setter="set_custom_punctuation" getter="get_custom_punctuation" default=""""> |
| 303 | Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used. |
| 304 | </member> |
| 305 | <member name="direction" type="int" setter="set_direction" getter="get_direction" enum="TextServer.Direction" default="0"> |
| 306 | Text writing direction. |
| 307 | </member> |
| 308 | <member name="ellipsis_char" type="String" setter="set_ellipsis_char" getter="get_ellipsis_char" default=""…""> |
| 309 | Ellipsis character used for text clipping. |
| 310 | </member> |
| 311 | <member name="justification_flags" type="int" setter="set_justification_flags" getter="get_justification_flags" enum="TextServer.JustificationFlag" is_bitfield="true" default="163"> |
| 312 | Line fill alignment rules. |
| 313 | </member> |
| 314 | <member name="line_spacing" type="float" setter="set_line_spacing" getter="get_line_spacing" default="0.0"> |
| 315 | Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative. |
| 316 | </member> |
| 317 | <member name="max_lines_visible" type="int" setter="set_max_lines_visible" getter="get_max_lines_visible" default="-1"> |
| 318 | Limits the lines of text shown. |
| 319 | </member> |
| 320 | <member name="orientation" type="int" setter="set_orientation" getter="get_orientation" enum="TextServer.Orientation" default="0"> |
| 321 | Text orientation. |
| 322 | </member> |
| 323 | <member name="preserve_control" type="bool" setter="set_preserve_control" getter="get_preserve_control" default="false"> |
| 324 | If set to [code]true[/code] text will display control characters. |
| 325 | </member> |
| 326 | <member name="preserve_invalid" type="bool" setter="set_preserve_invalid" getter="get_preserve_invalid" default="true"> |
| 327 | If set to [code]true[/code] text will display invalid characters. |
| 328 | </member> |
| 329 | <member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="TextServer.OverrunBehavior" default="0"> |
| 330 | The clipping behavior when the text exceeds the paragraph's set width. |
| 331 | </member> |
| 332 | <member name="width" type="float" setter="set_width" getter="get_width" default="-1.0"> |
| 333 | Paragraph width. |
| 334 | </member> |
| 335 | </members> |
| 336 | </class> |