Add example of loading a font from .ttf file
As this is a multi-step process it would be nice to have this documented.
(cherry picked from commit c89cc44a5e
)
This commit is contained in:
parent
e14226ebd4
commit
fa2f739ee0
|
@ -5,6 +5,12 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<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 [BitmapFont]s for the ability to change font parameters like size and spacing during runtime. [DynamicFontData] is used for referencing the font file paths.
|
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 [BitmapFont]s for the ability to change font parameters like size and spacing during runtime. [DynamicFontData] is used for referencing the font file paths.
|
||||||
|
[codeblock]
|
||||||
|
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)
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
|
Loading…
Reference in New Issue