File: Font.xml

package info (click to toggle)
godot 3.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 270,588 kB
  • sloc: cpp: 971,579; ansic: 617,953; xml: 80,302; asm: 17,498; cs: 14,559; python: 11,744; java: 9,681; javascript: 4,654; pascal: 1,176; sh: 896; objc: 529; makefile: 176
file content (167 lines) | stat: -rw-r--r-- 8,693 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Font" inherits="Resource" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		Internationalized font and text drawing support.
	</brief_description>
	<description>
		Font contains a Unicode-compatible character set, as well as the ability to draw it with variable width, ascent, descent and kerning. For creating fonts from TTF files (or other font formats), see the editor support for fonts.
		[b]Note:[/b] If a [DynamicFont] doesn't contain a character used in a string, the character in question will be replaced with codepoint [code]0xfffd[/code] if it's available in the [DynamicFont]. If this replacement character isn't available in the DynamicFont, the character will be hidden without displaying any replacement character in the string.
		[b]Note:[/b] If a [BitmapFont] doesn't contain a character used in a string, the character in question will be hidden without displaying any replacement character in the string.
		[b]Note:[/b] Unicode characters after [code]0xffff[/code] (such as most emoji) are [i]not[/i] supported on Windows. They will display as unknown characters instead. This will be resolved in Godot 4.0.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="draw" qualifiers="const">
			<return type="void" />
			<argument index="0" name="canvas_item" type="RID" />
			<argument index="1" name="position" type="Vector2" />
			<argument index="2" name="string" type="String" />
			<argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )" />
			<argument index="4" name="clip_w" type="int" default="-1" />
			<argument index="5" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 1 )" />
			<description>
				Draw [code]string[/code] into a canvas item using the font at a given position, with [code]modulate[/code] color, and optionally clipping the width. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
				See also [method CanvasItem.draw_string].
			</description>
		</method>
		<method name="draw_char" qualifiers="const">
			<return type="float" />
			<argument index="0" name="canvas_item" type="RID" />
			<argument index="1" name="position" type="Vector2" />
			<argument index="2" name="char" type="int" />
			<argument index="3" name="next" type="int" default="-1" />
			<argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )" />
			<argument index="5" name="outline" type="bool" default="false" />
			<description>
				Draw character [code]char[/code] into a canvas item using the font at a given position, with [code]modulate[/code] color, and optionally kerning if [code]next[/code] is passed. clipping the width. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character.
				If [code]outline[/code] is [code]true[/code], the outline of the character is drawn instead of the character itself.
			</description>
		</method>
		<method name="get_ascent" qualifiers="const">
			<return type="float" />
			<description>
				Returns the font ascent (number of pixels above the baseline).
			</description>
		</method>
		<method name="get_char_contours" qualifiers="const">
			<return type="Dictionary" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<description>
				Returns outline contours of the glyph as a [code]Dictionary[/code] with the following contents:
				[code]points[/code]         - [PoolVector3Array], containing outline points. [code]x[/code] and [code]y[/code] are point coordinates. [code]z[/code] is the type of the point, using the [enum ContourPointTag] values.
				[code]contours[/code]       - [PoolIntArray], containing indices the end points of each contour.
				[code]orientation[/code]    - [bool], contour orientation. If [code]true[/code], clockwise contours must be filled.
			</description>
		</method>
		<method name="get_char_size" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<description>
				Returns the size of a character, optionally taking kerning into account if the next character is provided. Note that the height returned is the font height (see [method get_height]) and has no relation to the glyph height.
			</description>
		</method>
		<method name="get_char_texture" qualifiers="const">
			<return type="RID" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<argument index="2" name="outline" type="bool" default="false" />
			<description>
				Returns resource id of the cache texture containing the char.
			</description>
		</method>
		<method name="get_char_texture_size" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<argument index="2" name="outline" type="bool" default="false" />
			<description>
				Returns size of the cache texture containing the char.
			</description>
		</method>
		<method name="get_char_tx_offset" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<argument index="2" name="outline" type="bool" default="false" />
			<description>
				Returns char offset from the baseline.
			</description>
		</method>
		<method name="get_char_tx_size" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<argument index="2" name="outline" type="bool" default="false" />
			<description>
				Returns size of the char.
			</description>
		</method>
		<method name="get_char_tx_uv_rect" qualifiers="const">
			<return type="Rect2" />
			<argument index="0" name="char" type="int" />
			<argument index="1" name="next" type="int" default="0" />
			<argument index="2" name="outline" type="bool" default="false" />
			<description>
				Returns rectangle in the cache texture containing the char.
			</description>
		</method>
		<method name="get_descent" qualifiers="const">
			<return type="float" />
			<description>
				Returns the font descent (number of pixels below the baseline).
			</description>
		</method>
		<method name="get_height" qualifiers="const">
			<return type="float" />
			<description>
				Returns the total font height (ascent plus descent) in pixels.
			</description>
		</method>
		<method name="get_string_size" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="string" type="String" />
			<description>
				Returns the size of a string, taking kerning and advance into account. Note that the height returned is the font height (see [method get_height]) and has no relation to the string.
			</description>
		</method>
		<method name="get_wordwrap_string_size" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="string" type="String" />
			<argument index="1" name="width" type="float" />
			<description>
				Returns the size that the string would have with word wrapping enabled with a fixed [code]width[/code].
			</description>
		</method>
		<method name="has_outline" qualifiers="const">
			<return type="bool" />
			<description>
				Returns [code]true[/code] if the font has an outline.
			</description>
		</method>
		<method name="is_distance_field_hint" qualifiers="const">
			<return type="bool" />
			<description>
			</description>
		</method>
		<method name="update_changes">
			<return type="void" />
			<description>
				After editing a font (changing size, ascent, char rects, etc.). Call this function to propagate changes to controls that might use it.
			</description>
		</method>
	</methods>
	<constants>
		<constant name="CONTOUR_CURVE_TAG_ON" value="1" enum="ContourPointTag">
			Contour point is on the curve.
		</constant>
		<constant name="CONTOUR_CURVE_TAG_OFF_CONIC" value="0" enum="ContourPointTag">
			Contour point isn't on the curve, but serves as a control point for a conic (quadratic) Bézier arc.
		</constant>
		<constant name="CONTOUR_CURVE_TAG_OFF_CUBIC" value="2" enum="ContourPointTag">
			Contour point isn't on the curve, but serves as a control point for a cubic Bézier arc.
		</constant>
	</constants>
</class>