summaryrefslogtreecommitdiff
path: root/doc/classes/BitmapFont.xml
blob: c013a474b2b23231e296ff21d061710657de4f3d (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
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BitmapFont" inherits="Font" category="Core" version="3.0-alpha">
	<brief_description>
		Renders text using [code]*.fnt[/code] fonts.
	</brief_description>
	<description>
		Renders text using [code]*.fnt[/code] fonts containing texture atlases. Supports distance fields. For using vector font files like TTF directly, see [DynamicFont].
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="add_char">
			<return type="void">
			</return>
			<argument index="0" name="character" type="int">
			</argument>
			<argument index="1" name="texture" type="int">
			</argument>
			<argument index="2" name="rect" type="Rect2">
			</argument>
			<argument index="3" name="align" type="Vector2" default="Vector2( 0, 0 )">
			</argument>
			<argument index="4" name="advance" type="float" default="-1">
			</argument>
			<description>
				Adds a character to the font, where [code]character[/code] is the unicode value, [code]texture[/code] is the texture index, [code]rect[/code] is the region in the texture (in pixels!), [code]align[/code] is the (optional) alignment for the character and [code]advance[/code] is the (optional) advance.
			</description>
		</method>
		<method name="add_kerning_pair">
			<return type="void">
			</return>
			<argument index="0" name="char_a" type="int">
			</argument>
			<argument index="1" name="char_b" type="int">
			</argument>
			<argument index="2" name="kerning" type="int">
			</argument>
			<description>
				Adds a kerning pair to the [code]BitmapFont[/code] as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character.
			</description>
		</method>
		<method name="add_texture">
			<return type="void">
			</return>
			<argument index="0" name="texture" type="Texture">
			</argument>
			<description>
				Adds a texture to the [code]BitmapFont[/code].
			</description>
		</method>
		<method name="clear">
			<return type="void">
			</return>
			<description>
				Clears all the font data and settings.
			</description>
		</method>
		<method name="create_from_fnt">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="path" type="String">
			</argument>
			<description>
				Creates a BitmapFont from the [code]*.fnt[/code] file at [code]path[/code].
			</description>
		</method>
		<method name="get_char_size" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="char" type="int">
			</argument>
			<argument index="1" name="next" type="int" default="0">
			</argument>
			<description>
				Returns the size of a character, optionally taking kerning into account if the next character is provided.
			</description>
		</method>
		<method name="get_fallback" qualifiers="const">
			<return type="BitmapFont">
			</return>
			<description>
				Returns the fallback BitmapFont.
			</description>
		</method>
		<method name="get_kerning_pair" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="char_a" type="int">
			</argument>
			<argument index="1" name="char_b" type="int">
			</argument>
			<description>
				Returns a kerning pair as a difference.
			</description>
		</method>
		<method name="get_texture" qualifiers="const">
			<return type="Texture">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Returns the font atlas texture at index [code]idx[/code].
			</description>
		</method>
		<method name="get_texture_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the number of textures in the BitmapFont atlas.
			</description>
		</method>
		<method name="set_ascent">
			<return type="void">
			</return>
			<argument index="0" name="px" type="float">
			</argument>
			<description>
				Sets the font ascent (number of pixels above the baseline).
			</description>
		</method>
		<method name="set_distance_field_hint">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				If [code]true[/code] distance field hint is enabled.
			</description>
		</method>
		<method name="set_fallback">
			<return type="void">
			</return>
			<argument index="0" name="fallback" type="BitmapFont">
			</argument>
			<description>
				Sets the fallback BitmapFont.
			</description>
		</method>
		<method name="set_height">
			<return type="void">
			</return>
			<argument index="0" name="px" type="float">
			</argument>
			<description>
				Sets the total font height (ascent plus descent) in pixels.
			</description>
		</method>
	</methods>
	<members>
		<member name="ascent" type="float" setter="set_ascent" getter="get_ascent">
			Ascent (number of pixels above the baseline).
		</member>
		<member name="chars" type="PoolIntArray" setter="_set_chars" getter="_get_chars">
			The characters in the BitmapFont.
		</member>
		<member name="distance_field" type="bool" setter="set_distance_field_hint" getter="is_distance_field_hint">
			If [code]true[/code] distance field hint is enabled.
		</member>
		<member name="fallback" type="BitmapFont" setter="set_fallback" getter="get_fallback">
			The fallback font.
		</member>
		<member name="height" type="float" setter="set_height" getter="get_height">
			Total font height (ascent plus descent) in pixels.
		</member>
		<member name="kernings" type="PoolIntArray" setter="_set_kernings" getter="_get_kernings">
			The font's kernings as [PoolIntArray].
		</member>
		<member name="textures" type="Array" setter="_set_textures" getter="_get_textures">
			The font's [Texture]s.
		</member>
	</members>
	<constants>
	</constants>
</class>