diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2019-04-23 06:04:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-23 06:04:25 +0300 |
commit | 2779bdf557c5baf1d06c3766de6b53a74bb74f13 (patch) | |
tree | 2c9668afa793663c9614bba682a284fdfab974e9 /doc | |
parent | 7ba772d4ba782925472e35ba371678fa01e1ee79 (diff) | |
parent | c89cc44a5e73de4d5c9558a224f5bfa99d538974 (diff) |
Merge pull request #27724 from follower/patch-2
Add example of loading a font from .ttf file
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/DynamicFont.xml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml index 99ba5143e3..5fdc1ebb75 100644 --- a/doc/classes/DynamicFont.xml +++ b/doc/classes/DynamicFont.xml @@ -5,6 +5,12 @@ </brief_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. + [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> <tutorials> </tutorials> |