Refreshing Cache...

Inherits: Font < Resource < Reference < Object

Renders text using fonts under the BMFont format.

Handles files with the .fnt extension.


Renders text using *.fnt fonts containing texture atlases. Supports distance fields. For using vector font files like TTF directly, see DynamicFont.


voidadd_char ( int character, int texture, Rect2 rect, Vector2 align=Vector2( 0, 0 ), float advance=-1 )
voidadd_kerning_pair ( int char_a, int char_b, int kerning )
voidadd_texture ( Texture texture )
voidclear ( )
Errorcreate_from_fnt ( String path )
Vector2get_char_size ( int char, int next=0 ) const
intget_kerning_pair ( int char_a, int char_b ) const
Textureget_texture ( int idx ) const
intget_texture_count ( ) const

Property Descriptions


Ascent (number of pixels above the baseline).


If true, distance field hint is enabled.


The fallback font.


Total font height (ascent plus descent) in pixels.

Method Descriptions

Adds a character to the font, where character is the Unicode value, texture is the texture index, rect is the region in the texture (in pixels!), align is the (optional) alignment for the character and advance is the (optional) advance.

  • void add_kerning_pair ( int char_a, int char_b, int kerning )

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.

  • void add_texture ( Texture texture )

Adds a texture to the BitmapFont.

  • void clear ( )

Clears all the font data and settings.

Creates a BitmapFont from the *.fnt file at path.

Returns the size of a character, optionally taking kerning into account if the next character is provided.

  • int get_kerning_pair ( int char_a, int char_b ) const

Returns a kerning pair as a difference.

Returns the font atlas texture at index idx.

  • int get_texture_count ( ) const

Returns the number of textures in the BitmapFont atlas.

doradoro's advice! Getters and Setters will be deprecated! Avoid their use!

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 2020-03-07 at 01:30:25. It's the English Stable version because it's what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.