Built-in text servers support font data sources of the following formats:
- Bitmap fonts in the [url=https://www.angelcode.com/products/bmfont/]BMFont[/url] format. Handles [code].fnt, *.font[/code] fonts containing texture atlases. Non-scalable. Supports distance fields. Complex text shaping support is limited.
- Dynamic fonts using the [url=https://www.freetype.org/]FreeType[/url] and [url=https://github.com/silnrsi/graphite/]Graphite[/url] library for rasterization. Handles [code]*.ttf, *.otf[/code] fonts. Scalable. Doesn't support distance fields. Supports complex text shaping and OpenType features.
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>
<methodname="bitmap_add_kerning_pair">
<returntype="void">
</return>
<argumentindex="0"name="A"type="int">
</argument>
<argumentindex="1"name="B"type="int">
</argument>
<argumentindex="2"name="kerning"type="int">
</argument>
<description>
Adds a kerning pair to the bitmap font as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character.
Draws single glyph into a canvas item at the position, using [code]font[/code] at the size [code]size[/code].
Returns advance of the glyph for horizontal and vertical layouts.
Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data.
Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font[/code] at the size [code]size[/code]. If outline drawing is not supported, nothing is drawn.
Returns advance of the glyph for horizontal and vertical layouts (regardless of outline drawing support).
Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data.
</description>
</method>
<methodname="get_ascent"qualifiers="const">
<returntype="float">
</return>
<argumentindex="0"name="size"type="int">
</argument>
<description>
Returns the font ascent (number of pixels above the baseline).
</description>
</method>
<methodname="get_base_size"qualifiers="const">
<returntype="float">
</return>
<description>
Returns the base size of the font (the only size supported for non-scalable fonts, meaningless for scalable fonts).
</description>
</method>
<methodname="get_descent"qualifiers="const">
<returntype="float">
</return>
<argumentindex="0"name="size"type="int">
</argument>
<description>
Returns the font descent (number of pixels below the baseline).
Returns advance of the glyph for horizontal and vertical layouts.
Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data.
Returns a kerning of the pair of glyphs for horizontal and vertical layouts.
Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data.
</description>
</method>
<methodname="get_height"qualifiers="const">
<returntype="float">
</return>
<argumentindex="0"name="size"type="int">
</argument>
<description>
Returns the total font height (ascent plus descent) in pixels.
Returns list of supported [url=https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg]variation coordinates[/url], each coordinate is returned as [code]tag: Vector3i(min_value,max_value,default_value)[/code].
Font variations allow for continuous change of glyph characteristics along some given design axis, such as weight, width or slant.