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...
FontVariation¶
Inherits: Font < Resource < RefCounted < Object
A variation of a font with additional settings.
Description¶
Provides OpenType variations, simulated bold / slant, and additional font settings like OpenType features and extra spacing.
To use simulated bold font variant:
var fv = FontVariation.new()
fv.set_base_font(load("res://BarlowCondensed-Regular.ttf"))
fv.set_variation_embolden(1.2)
$Label.add_theme_font_override("font", fv)
$Label.add_theme_font_size_override("font_size", 64)
var fv = new FontVariation();
fv.SetBaseFont(ResourceLoader.Load<FontFile>("res://BarlowCondensed-Regular.ttf"));
fv.SetVariationEmbolden(1.2);
GetNode("Label").AddThemeFontOverride("font", fv);
GetNode("Label").AddThemeFontSizeOverride("font_size", 64);
To set the coordinate of multiple variation axes:
var fv = FontVariation.new();
var ts = TextServerManager.get_primary_interface()
fv.base_font = load("res://BarlowCondensed-Regular.ttf")
fv.variation_opentype = { ts.name_to_tag("wght"): 900, ts.name_to_tag("custom_hght"): 900 }
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
set_spacing ( SpacingType spacing, int value ) |
Property Descriptions¶
Font base_font
Base font used to create a variation. If not set, default Theme font is used.
Dictionary opentype_features = {}
void set_opentype_features ( Dictionary value )
Dictionary get_opentype_features ( )
A set of OpenType feature tags. More info: OpenType feature tags.
int spacing_bottom = 0
void set_spacing ( SpacingType spacing, int value )
int get_spacing ( )
Extra spacing at the bottom of the line in pixels.