Complete FontFile ref and update example
I complete the ref items according to [TextServer ref](https://docs.godotengine.org/en/latest/classes/class_textserver.html) and update example with new properties path
This commit is contained in:
parent
47c3e3b781
commit
57d495f43b
|
@ -17,13 +17,13 @@
|
||||||
[codeblocks]
|
[codeblocks]
|
||||||
[gdscript]
|
[gdscript]
|
||||||
var f = load("res://BarlowCondensed-Bold.ttf")
|
var f = load("res://BarlowCondensed-Bold.ttf")
|
||||||
$"Label".set("custom_fonts/font", f)
|
$Label.add_theme_font_override("font", f)
|
||||||
$"Label".set("custom_fonts/font_size", 64)
|
$Label.add_theme_font_size_override("font_size", 64)
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
var f = ResourceLoader.Load<FontFile>("res://BarlowCondensed-Bold.ttf");
|
var f = ResourceLoader.Load<FontFile>("res://BarlowCondensed-Bold.ttf");
|
||||||
GetNode("Label").Set("custom_fonts/font", f);
|
GetNode("Label").AddThemeFontOverride("font", f);
|
||||||
GetNode("Label").Set("custom_font_sizes/font_size", 64);
|
GetNode("Label").AddThemeFontSizeOverride("font_size", 64);
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
</description>
|
</description>
|
||||||
|
@ -88,6 +88,7 @@
|
||||||
<param index="0" name="cache_index" type="int" />
|
<param index="0" name="cache_index" type="int" />
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Returns the font descent (number of pixels below the baseline).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_cache_scale" qualifiers="const">
|
<method name="get_cache_scale" qualifiers="const">
|
||||||
|
@ -95,6 +96,7 @@
|
||||||
<param index="0" name="cache_index" type="int" />
|
<param index="0" name="cache_index" type="int" />
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Returns scaling factor of the color bitmap font.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_cache_underline_position" qualifiers="const">
|
<method name="get_cache_underline_position" qualifiers="const">
|
||||||
|
@ -102,6 +104,7 @@
|
||||||
<param index="0" name="cache_index" type="int" />
|
<param index="0" name="cache_index" type="int" />
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Returns pixel offset of the underline below the baseline.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_cache_underline_thickness" qualifiers="const">
|
<method name="get_cache_underline_thickness" qualifiers="const">
|
||||||
|
@ -109,6 +112,7 @@
|
||||||
<param index="0" name="cache_index" type="int" />
|
<param index="0" name="cache_index" type="int" />
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Returns thickness of the underline in pixels.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_embolden" qualifiers="const">
|
<method name="get_embolden" qualifiers="const">
|
||||||
|
@ -377,6 +381,7 @@
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<param index="2" name="ascent" type="float" />
|
<param index="2" name="ascent" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Sets the font ascent (number of pixels above the baseline).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_cache_descent">
|
<method name="set_cache_descent">
|
||||||
|
@ -385,6 +390,7 @@
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<param index="2" name="descent" type="float" />
|
<param index="2" name="descent" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Sets the font descent (number of pixels below the baseline).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_cache_scale">
|
<method name="set_cache_scale">
|
||||||
|
@ -393,6 +399,7 @@
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<param index="2" name="scale" type="float" />
|
<param index="2" name="scale" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Sets scaling factor of the color bitmap font.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_cache_underline_position">
|
<method name="set_cache_underline_position">
|
||||||
|
@ -401,6 +408,7 @@
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<param index="2" name="underline_position" type="float" />
|
<param index="2" name="underline_position" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Sets pixel offset of the underline below the baseline.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_cache_underline_thickness">
|
<method name="set_cache_underline_thickness">
|
||||||
|
@ -409,6 +417,7 @@
|
||||||
<param index="1" name="size" type="int" />
|
<param index="1" name="size" type="int" />
|
||||||
<param index="2" name="underline_thickness" type="float" />
|
<param index="2" name="underline_thickness" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Sets thickness of the underline in pixels.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_embolden">
|
<method name="set_embolden">
|
||||||
|
|
|
@ -10,16 +10,16 @@
|
||||||
[gdscript]
|
[gdscript]
|
||||||
var fv = FontVariation.new()
|
var fv = FontVariation.new()
|
||||||
fv.set_base_font(load("res://BarlowCondensed-Regular.ttf"))
|
fv.set_base_font(load("res://BarlowCondensed-Regular.ttf"))
|
||||||
fv.set_variation_embolden(1.2);
|
fv.set_variation_embolden(1.2)
|
||||||
$"Label".set("custom_fonts/font", fv)
|
$Label.add_theme_font_override("font", fv)
|
||||||
$"Label".set("custom_fonts/font_size", 64)
|
$Label.add_theme_font_size_override("font_size", 64)
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
var fv = new FontVariation();
|
var fv = new FontVariation();
|
||||||
fv.SetBaseFont(ResourceLoader.Load<FontFile>("res://BarlowCondensed-Regular.ttf"));
|
fv.SetBaseFont(ResourceLoader.Load<FontFile>("res://BarlowCondensed-Regular.ttf"));
|
||||||
fv.SetVariationEmbolden(1.2);
|
fv.SetVariationEmbolden(1.2);
|
||||||
GetNode("Label").Set("custom_fonts/font", fv);
|
GetNode("Label").AddThemeFontOverride("font", fv);
|
||||||
GetNode("Label").Set("custom_font_sizes/font_size", 64);
|
GetNode("Label").AddThemeFontSizeOverride("font_size", 64);
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
</description>
|
</description>
|
||||||
|
|
Loading…
Reference in New Issue