summaryrefslogtreecommitdiff
path: root/doc/classes/TextParagraph.xml
blob: 811fe32eb265aa972257638438b2f71844e57c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TextParagraph" inherits="RefCounted" version="4.0">
	<brief_description>
		Holds a paragraph of text.
	</brief_description>
	<description>
		Abstraction over [TextServer] for handling paragraph of text.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="add_object">
			<return type="bool" />
			<argument index="0" name="key" type="Variant" />
			<argument index="1" name="size" type="Vector2" />
			<argument index="2" name="inline_align" type="int" enum="InlineAlign" default="5" />
			<argument index="3" name="length" type="int" default="1" />
			<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">
			<return type="bool" />
			<argument index="0" name="text" type="String" />
			<argument index="1" name="fonts" type="Font" />
			<argument index="2" name="size" type="int" />
			<argument index="3" name="opentype_features" type="Dictionary" default="{
}" />
			<argument index="4" name="language" type="String" default="&quot;&quot;" />
			<description>
				Adds text span and font to draw it.
			</description>
		</method>
		<method name="clear">
			<return type="void" />
			<description>
				Clears text paragraph (removes text and inline objects).
			</description>
		</method>
		<method name="clear_dropcap">
			<return type="void" />
			<description>
				Removes dropcap.
			</description>
		</method>
		<method name="draw" qualifiers="const">
			<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)" />
			<argument index="3" name="dc_color" type="Color" default="Color(1, 1, 1, 1)" />
			<description>
				Draw all lines of the text and drop cap 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_dropcap" qualifiers="const">
			<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)" />
			<description>
				Draw drop cap 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_dropcap_outline" qualifiers="const">
			<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)" />
			<description>
				Draw drop cap outline 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_line" qualifiers="const">
			<return type="void" />
			<argument index="0" name="canvas" type="RID" />
			<argument index="1" name="pos" type="Vector2" />
			<argument index="2" name="line" type="int" />
			<argument index="3" name="color" type="Color" default="Color(1, 1, 1, 1)" />
			<description>
				Draw single line of 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_line_outline" qualifiers="const">
			<return type="void" />
			<argument index="0" name="canvas" type="RID" />
			<argument index="1" name="pos" type="Vector2" />
			<argument index="2" name="line" type="int" />
			<argument index="3" name="outline_size" type="int" default="1" />
			<argument index="4" name="color" type="Color" default="Color(1, 1, 1, 1)" />
			<description>
				Draw outline of the single line of 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">
			<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)" />
			<argument index="4" name="dc_color" type="Color" default="Color(1, 1, 1, 1)" />
			<description>
				Draw outlines of all lines of the text and drop cap 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_dropcap_lines" qualifiers="const">
			<return type="int" />
			<description>
				Returns number of lines used by dropcap.
			</description>
		</method>
		<method name="get_dropcap_rid" qualifiers="const">
			<return type="RID" />
			<description>
				Return drop cap text buffer RID.
			</description>
		</method>
		<method name="get_dropcap_size" qualifiers="const">
			<return type="Vector2" />
			<description>
				Returns drop cap bounding box size.
			</description>
		</method>
		<method name="get_line_ascent" qualifiers="const">
			<return type="float" />
			<argument index="0" name="line" type="int" />
			<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">
			<return type="int" />
			<description>
				Returns number of lines in the paragraph.
			</description>
		</method>
		<method name="get_line_descent" qualifiers="const">
			<return type="float" />
			<argument index="0" name="line" type="int" />
			<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">
			<return type="Rect2" />
			<argument index="0" name="line" type="int" />
			<argument index="1" name="key" type="Variant" />
			<description>
				Returns bounding rectangle of the inline object.
			</description>
		</method>
		<method name="get_line_objects" qualifiers="const">
			<return type="Array" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns array of inline objects in the line.
			</description>
		</method>
		<method name="get_line_range" qualifiers="const">
			<return type="Vector2i" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns character range of the line.
			</description>
		</method>
		<method name="get_line_rid" qualifiers="const">
			<return type="RID" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns TextServer line buffer RID.
			</description>
		</method>
		<method name="get_line_size" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns size of the bounding box of the line of text.
			</description>
		</method>
		<method name="get_line_underline_position" qualifiers="const">
			<return type="float" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns pixel offset of the underline below the baseline.
			</description>
		</method>
		<method name="get_line_underline_thickness" qualifiers="const">
			<return type="float" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns thickness of the underline.
			</description>
		</method>
		<method name="get_line_width" qualifiers="const">
			<return type="float" />
			<argument index="0" name="line" type="int" />
			<description>
				Returns width (for horizontal layout) or height (for vertical) of the line of text.
			</description>
		</method>
		<method name="get_non_wraped_size" qualifiers="const">
			<return type="Vector2" />
			<description>
				Returns the size of the bounding box of the paragraph, without line breaks.
			</description>
		</method>
		<method name="get_rid" qualifiers="const">
			<return type="RID" />
			<description>
				Returns TextServer full string buffer RID.
			</description>
		</method>
		<method name="get_size" qualifiers="const">
			<return type="Vector2" />
			<description>
				Returns the size of the bounding box of the paragraph.
			</description>
		</method>
		<method name="get_spacing_bottom" qualifiers="const">
			<return type="int" />
			<description>
				Returns extra spacing at the bottom of the line. See [member Font.extra_spacing_bottom].
			</description>
		</method>
		<method name="get_spacing_top" qualifiers="const">
			<return type="int" />
			<description>
				Returns extra spacing at the top of the line. See [member Font.extra_spacing_top].
			</description>
		</method>
		<method name="hit_test" qualifiers="const">
			<return type="int" />
			<argument index="0" name="coords" type="Vector2" />
			<description>
				Returns caret character offset at the specified coordinates. This function always returns a valid position.
			</description>
		</method>
		<method name="resize_object">
			<return type="bool" />
			<argument index="0" name="key" type="Variant" />
			<argument index="1" name="size" type="Vector2" />
			<argument index="2" name="inline_align" type="int" enum="InlineAlign" default="5" />
			<description>
				Sets new size and alignment of embedded object.
			</description>
		</method>
		<method name="set_bidi_override">
			<return type="void" />
			<argument index="0" name="override" type="Array" />
			<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="set_dropcap">
			<return type="bool" />
			<argument index="0" name="text" type="String" />
			<argument index="1" name="fonts" type="Font" />
			<argument index="2" name="size" type="int" />
			<argument index="3" name="dropcap_margins" type="Rect2" default="Rect2(0, 0, 0, 0)" />
			<argument index="4" name="opentype_features" type="Dictionary" default="{
}" />
			<argument index="5" name="language" type="String" default="&quot;&quot;" />
			<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>
		<method name="tab_align">
			<return type="void" />
			<argument index="0" name="tab_stops" type="PackedFloat32Array" />
			<description>
				Aligns paragraph to the given tab-stops.
			</description>
		</method>
	</methods>
	<members>
		<member name="align" type="int" setter="set_align" getter="get_align" enum="HAlign" default="0">
			Paragraph horizontal alignment.
		</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="51">
			Line breaking and 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>
		<member name="width" type="float" setter="set_width" getter="get_width" default="-1.0">
			Paragraph width.
		</member>
	</members>
	<constants>
	</constants>
</class>