Font class is set of font data sources used to draw text.
</brief_description>
<description>
Font contains a set of glyphs to represent Unicode characters, as well as the ability to draw it with variable width, ascent, descent and kerning.
[b]Note:[/b] A character is a symbol that represents an item (letter, digit etc.) in an abstract way.
[b]Note:[/b] A glyph is a bitmap or shape used to draw a one or more characters in a context-dependent manner. Glyph indices are bound to the specific font data source.
[b]Note:[/b] If a non of the font data sources contain glyphs for a character used in a string, the character in question will be replaced with a box displaying its hexadecimal code.
Draw a single Unicode 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. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
[b]Note:[/b] Do not use this function to draw strings character by character, use [method draw_string] or [TextLine] instead.
Breaks [code]text[/code] to the lines using rules specified by [code]flags[/code] and draws it into a canvas item using the font, at a given position, with [code]modulate[/code] color, optionally clipping the width and aligning horizontally. [code]position[/code] specifies the baseline of the first line, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
See also [method CanvasItem.draw_multiline_string].
Draw [code]text[/code] into a canvas item using the font, at a given position, with [code]modulate[/code] color, optionally clipping the width and aligning horizontally. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
Returns the average font ascent (number of pixels above the baseline).
[b]Note:[/b] Real ascent of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the ascent of empty line).
Returns the average font descent (number of pixels below the baseline).
[b]Note:[/b] Real descent of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the descent of empty line).
Returns the total average font height (ascent plus descent) in pixels.
[b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the height of empty line).
Return average pixel offset of the underline below the baseline.
[b]Note:[/b] Real underline position of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate.
[b]Note:[/b] Real underline thickness of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate.
</description>
</method>
<methodname="has_char"qualifiers="const">
<returntype="bool">
</return>
<argumentindex="0"name="char"type="int">
</argument>
<description>
Return [code]true[/code] if a Unicode [code]char[/code] is available in the font.
</description>
</method>
<methodname="remove_data">
<returntype="void">
</return>
<argumentindex="0"name="idx"type="int">
</argument>
<description>
Removes the font data source at index [code]idx[/code]. If the index does not exist, nothing happens.
</description>
</method>
<methodname="set_data">
<returntype="void">
</return>
<argumentindex="0"name="idx"type="int">
</argument>
<argumentindex="1"name="data"type="FontData">
</argument>
<description>
Sets the font data source at index [code]idx[/code]. If the index does not exist, nothing happens.
</description>
</method>
<methodname="set_spacing">
<returntype="void">
</return>
<argumentindex="0"name="type"type="int">
</argument>
<argumentindex="1"name="value"type="int">
</argument>
<description>
Sets the spacing for [code]type[/code] (see [enum SpacingType]) to [code]value[/code] in pixels (not relative to the font size).
</description>
</method>
<methodname="update_changes">
<returntype="void">
</return>
<description>
After editing a font (changing data sources, etc.). Call this function to propagate changes to controls that might use it.