FontVariation¶
Inherits: Font < Resource < RefCounted < Object
Variation of the Font.
Description¶
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".set("custom_fonts/font", fv)
$"Label".set("custom_fonts/font_size", 64)
var fv = new FontVariation();
fv.SetBaseFont(ResourceLoader.Load<FontFile>("res://BarlowCondensed-Regular.ttf"));
fv.SetVariationEmbolden(1.2);
GetNode("Label").Set("custom_fonts/font", fv);
GetNode("Label").Set("custom_font_sizes/font_size", 64);
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
set_spacing ( SpacingType spacing, int value ) |
Property Descriptions¶
Font base_font
Setter |
set_base_font(value) |
Getter |
get_base_font() |
Base font used to create a variation. If not set, default Theme font is used.
Font[] fallbacks
Default |
|
Setter |
set_fallbacks(value) |
Getter |
get_fallbacks() |
Array of fallback Fonts. If not set base_font fallback are ussed.
Dictionary opentype_features
Default |
|
Setter |
set_opentype_features(value) |
Getter |
get_opentype_features() |
A set of OpenType feature tags. More info: OpenType feature tags.
int spacing_bottom
Default |
|
Setter |
set_spacing(value) |
Getter |
get_spacing() |
Extra spacing at the bottom of the line in pixels.
int spacing_glyph
Default |
|
Setter |
set_spacing(value) |
Getter |
get_spacing() |
Extra spacing between graphical glyphs
int spacing_space
Default |
|
Setter |
set_spacing(value) |
Getter |
get_spacing() |
Extra width of the space glyphs.
int spacing_top
Default |
|
Setter |
set_spacing(value) |
Getter |
get_spacing() |
Extra spacing at the top of the line in pixels.
float variation_embolden
Default |
|
Setter |
set_variation_embolden(value) |
Getter |
get_variation_embolden() |
If is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness.
Note: Emboldened fonts might have self-intersecting outlines, which will prevent MSDF fonts and TextMesh from working correctly.
int variation_face_index
Default |
|
Setter |
set_variation_face_index(value) |
Getter |
get_variation_face_index() |
Active face index in the TrueType / OpenType collection file.
Dictionary variation_opentype
Default |
|
Setter |
set_variation_opentype(value) |
Getter |
get_variation_opentype() |
Font OpenType variation coordinates. More info: OpenType variation tags.
Transform2D variation_transform
Default |
|
Setter |
set_variation_transform(value) |
Getter |
get_variation_transform() |
2D transform, applied to the font outlines, can be used for slanting, flipping and rotating glyphs.
For example, to simulate italic typeface by slanting, apply the following transform Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0)
.
Method Descriptions¶
void set_spacing ( SpacingType spacing, int value )
Sets the spacing for type
(see SpacingType) to value
in pixels (not relative to the font size).