DynamicFont
Inherits: Font < Resource < Reference < Object
Category: Core
Brief Description
DynamicFont renders vector font files at runtime.
Properties
int | extra_spacing_bottom |
int | extra_spacing_char |
int | extra_spacing_space |
int | extra_spacing_top |
DynamicFontData | font_data |
Color | outline_color |
int | outline_size |
int | size |
bool | use_filter |
bool | use_mipmaps |
Methods
void | add_fallback ( DynamicFontData data ) |
DynamicFontData | get_fallback ( int idx ) const |
int | get_fallback_count ( ) const |
void | remove_fallback ( int idx ) |
void | set_fallback ( int idx, DynamicFontData data ) |
Enumerations
enum SpacingType:
- SPACING_TOP = 0 — Spacing at the top.
- SPACING_BOTTOM = 1 — Spacing at the bottom.
- SPACING_CHAR = 2 — Character spacing.
- SPACING_SPACE = 3 — Space spacing.
Description
DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like BitmapFont. This trades the faster loading time of BitmapFonts for the ability to change font parameters like size and spacing during runtime. DynamicFontData is used for referencing the font file paths.
var dynamic_font = DynamicFont.new()
dynamic_font.font_data = load("res://BarlowCondensed-Bold.ttf")
dynamic_font.size = 64
$"Label".set("custom_fonts/font", dynamic_font)
Property Descriptions
- int extra_spacing_bottom
Setter | set_spacing(value) |
Getter | get_spacing() |
Extra spacing at the bottom in pixels.
- int extra_spacing_char
Setter | set_spacing(value) |
Getter | get_spacing() |
Extra character spacing in pixels.
- int extra_spacing_space
Setter | set_spacing(value) |
Getter | get_spacing() |
Extra space spacing in pixels.
- int extra_spacing_top
Setter | set_spacing(value) |
Getter | get_spacing() |
Extra spacing at the top in pixels.
- DynamicFontData font_data
Setter | set_font_data(value) |
Getter | get_font_data() |
The font data.
- Color outline_color
Setter | set_outline_color(value) |
Getter | get_outline_color() |
- int outline_size
Setter | set_outline_size(value) |
Getter | get_outline_size() |
- int size
Setter | set_size(value) |
Getter | get_size() |
The font size.
- bool use_filter
Setter | set_use_filter(value) |
Getter | get_use_filter() |
If true
, filtering is used.
- bool use_mipmaps
Setter | set_use_mipmaps(value) |
Getter | get_use_mipmaps() |
If true
, mipmapping is used.
Method Descriptions
- void add_fallback ( DynamicFontData data )
Adds a fallback font.
- DynamicFontData get_fallback ( int idx ) const
Returns the fallback font at index idx
.
- int get_fallback_count ( ) const
Returns the number of fallback fonts.
- void remove_fallback ( int idx )
Removes the fallback font at index idx
.
- void set_fallback ( int idx, DynamicFontData data )
Sets the fallback font at index idx
.