summaryrefslogtreecommitdiff
path: root/doc/classes/DynamicFont.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/DynamicFont.xml')
-rw-r--r--doc/classes/DynamicFont.xml12
1 files changed, 10 insertions, 2 deletions
diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml
index f687937e27..d2d0c54761 100644
--- a/doc/classes/DynamicFont.xml
+++ b/doc/classes/DynamicFont.xml
@@ -6,12 +6,20 @@
<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 also supports defining one or more fallback fonts, which will be used when displaying a character not supported by the main font.
DynamicFont uses the [url=https://www.freetype.org/]FreeType[/url] library for rasterization.
- [codeblock]
+ [codeblocks]
+ [gdscript]
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]
+ [/gdscript]
+ [csharp]
+ var dynamicFont = new DynamicFont();
+ dynamicFont.FontData = ResourceLoader.Load&lt;DynamicFontData&gt;("res://BarlowCondensed-Bold.ttf");
+ dynamicFont.Size = 64;
+ GetNode("Label").Set("custom_fonts/font", dynamicFont);
+ [/csharp]
+ [/codeblocks]
[b]Note:[/b] DynamicFont doesn't support features such as kerning, right-to-left typesetting, ligatures, text shaping, variable fonts and optional font features yet. If you wish to "bake" an optional font feature into a TTF font file, you can use [url=https://fontforge.org/]FontForge[/url] to do so. In FontForge, use [b]File &gt; Generate Fonts[/b], click [b]Options[/b], choose the desired features then generate the font.
</description>
<tutorials>