From c89cc44a5e73de4d5c9558a224f5bfa99d538974 Mon Sep 17 00:00:00 2001 From: follower Date: Sat, 6 Apr 2019 23:06:08 +1300 Subject: [PATCH] Add example of loading a font from .ttf file As this is a multi-step process it would be nice to have this documented. --- doc/classes/DynamicFont.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml index 500da1b30fc..b3bb711db21 100644 --- a/doc/classes/DynamicFont.xml +++ b/doc/classes/DynamicFont.xml @@ -5,6 +5,12 @@ 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]