Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Font¶
Inherits: Resource < RefCounted < Object
Inherited By: FontFile, FontVariation, SystemFont
Abstract base class for fonts and font variations.
Description¶
Abstract base class for different font types. It has methods for drawing text and font character introspection.
Properties¶
|
Methods¶
draw_char ( RID canvas_item, Vector2 pos, int char, int font_size, Color modulate=Color(1, 1, 1, 1) ) const |
|
draw_char_outline ( RID canvas_item, Vector2 pos, int char, int font_size, int size=-1, Color modulate=Color(1, 1, 1, 1) ) const |
|
void |
draw_multiline_string ( RID canvas_item, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, Color modulate=Color(1, 1, 1, 1), BitField<LineBreakFlag> brk_flags=3, BitField<JustificationFlag> justification_flags=3, Direction direction=0, Orientation orientation=0 ) const |
void |
draw_multiline_string_outline ( RID canvas_item, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, int size=1, Color modulate=Color(1, 1, 1, 1), BitField<LineBreakFlag> brk_flags=3, BitField<JustificationFlag> justification_flags=3, Direction direction=0, Orientation orientation=0 ) const |
void |
draw_string ( RID canvas_item, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, Color modulate=Color(1, 1, 1, 1), BitField<JustificationFlag> justification_flags=3, Direction direction=0, Orientation orientation=0 ) const |
void |
draw_string_outline ( RID canvas_item, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int size=1, Color modulate=Color(1, 1, 1, 1), BitField<JustificationFlag> justification_flags=3, Direction direction=0, Orientation orientation=0 ) const |
find_variation ( Dictionary variation_coordinates, int face_index=0, float strength=0.0, Transform2D transform=Transform2D(1, 0, 0, 1, 0, 0), int spacing_top=0, int spacing_bottom=0, int spacing_space=0, int spacing_glyph=0 ) const |
|
get_ascent ( int font_size=16 ) const |
|
get_char_size ( int char, int font_size ) const |
|
get_descent ( int font_size=16 ) const |
|
get_face_count ( ) const |
|
get_font_name ( ) const |
|
get_font_stretch ( ) const |
|
BitField<FontStyle> |
get_font_style ( ) const |
get_font_style_name ( ) const |
|
get_font_weight ( ) const |
|
get_height ( int font_size=16 ) const |
|
get_multiline_string_size ( String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, int max_lines=-1, BitField<LineBreakFlag> brk_flags=3, BitField<JustificationFlag> justification_flags=3, Direction direction=0, Orientation orientation=0 ) const |
|
get_opentype_features ( ) const |
|
get_ot_name_strings ( ) const |
|
get_rids ( ) const |
|
get_spacing ( SpacingType spacing ) const |
|
get_string_size ( String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16, BitField<JustificationFlag> justification_flags=3, Direction direction=0, Orientation orientation=0 ) const |
|
get_supported_chars ( ) const |
|
get_supported_feature_list ( ) const |
|
get_supported_variation_list ( ) const |
|
get_underline_position ( int font_size=16 ) const |
|
get_underline_thickness ( int font_size=16 ) const |
|
is_language_supported ( String language ) const |
|
is_script_supported ( String script ) const |
|
void |
set_cache_capacity ( int single_line, int multi_line ) |
Property Descriptions¶
Font[] fallbacks = []
Array of fallback Fonts to use as a substitute if a glyph is not found in this current Font.
If this array is empty in a FontVariation, the FontVariation.base_font's fallbacks are used instead.
Method Descriptions¶
float draw_char ( RID canvas_item, Vector2 pos, int char, int font_size, Color modulate=Color(1, 1, 1, 1) ) const
Draw a single Unicode character char
into a canvas item using the font, at a given position, with modulate
color. pos
specifies the baseline, not the top. To draw from the top, ascent must be added to the Y axis.
Note: Do not use this function to draw strings character by character, use draw_string or TextLine instead.
float draw_char_outline ( RID canvas_item, Vector2 pos, int char, int font_size, int size=-1, Color modulate=Color(1, 1, 1, 1) ) const
Draw a single Unicode character char
outline into a canvas item using the font, at a given position, with modulate
color and size
outline size. pos
specifies the baseline, not the top. To draw from the top, ascent must be added to the Y axis.
Note: Do not use this function to draw strings character by character, use draw_string or TextLine instead.
void draw_multiline_string ( RID canvas_item, Vector2 pos, String text, HorizontalAlignment alignment=0, float width=-1, int font_size=16,