godot/doc/classes/BitmapFont.xml
2021-11-05 16:10:17 +01:00

92 lines
3.6 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="BitmapFont" inherits="Font" version="3.5">
<brief_description>
Renders text using fonts under the [url=https://www.angelcode.com/products/bmfont/]BMFont[/url] format.
Handles files with the [code].fnt[/code] extension.
</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>
<methods>
<method name="add_char">
<return type="void" />
<argument index="0" name="character" type="int" />
<argument index="1" name="texture" type="int" />
<argument index="2" name="rect" type="Rect2" />
<argument index="3" name="align" type="Vector2" default="Vector2( 0, 0 )" />
<argument index="4" name="advance" type="float" default="-1" />
<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" />
<argument index="0" name="char_a" type="int" />
<argument index="1" name="char_b" type="int" />
<argument index="2" name="kerning" type="int" />
<description>
Adds a kerning pair to the [BitmapFont] 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" />
<argument index="0" name="texture" type="Texture" />
<description>
Adds a texture to the [BitmapFont].
</description>
</method>
<method name="clear">
<return type="void" />
<description>
Clears all the font data and settings.
</description>
</method>
<method name="create_from_fnt">
<return type="int" enum="Error" />
<argument index="0" name="path" type="String" />
<description>
Creates a BitmapFont from the [code]*.fnt[/code] file at [code]path[/code].
</description>
</method>
<method name="get_kerning_pair" qualifiers="const">
<return type="int" />
<argument index="0" name="char_a" type="int" />
<argument index="1" name="char_b" type="int" />
<description>
Returns a kerning pair as a difference.
</description>
</method>
<method name="get_texture" qualifiers="const">
<return type="Texture" />
<argument index="0" name="idx" type="int" />
<description>
Returns the font atlas texture at index [code]idx[/code].
</description>
</method>
<method name="get_texture_count" qualifiers="const">
<return type="int" />
<description>
Returns the number of textures in the BitmapFont atlas.
</description>
</method>
</methods>
<members>
<member name="ascent" type="float" setter="set_ascent" getter="get_ascent" default="0.0">
Ascent (number of pixels above the baseline).
</member>
<member name="distance_field" type="bool" setter="set_distance_field_hint" getter="is_distance_field_hint" default="false">
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" default="1.0">
Total font height (ascent plus descent) in pixels.
</member>
</members>
<constants>
</constants>
</class>