How can I get the DynamicFont resources from a label in gdscript?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By icqqq

I cannot find any property like “font” in a label node

so how can I get the DynamicFont ?

Actually what I want is change the font size of the DynamicFont in gdscript


:bust_in_silhouette: Reply From: Paintbox

In the inspector you can find the font properties under “custom fonts” , its quite a scroll down mind you.

enter image description here

And for changing the font size there is this QA :

I want to get the font in gdscript, not editor

Thank you

icqqq | 2018-08-28 10:18

:bust_in_silhouette: Reply From: ZacB

easy ^^

  $YourLabel.add_font_override("font", load("Your font's path"))

What if I already set the font in editor?
How can I access the font in gdscript?
Thank you.

icqqq | 2018-08-28 10:19

You have to create a font (.tres) and then copy its path (right click → copy path). Replace “Your font’s path” by this path and it should work. No problem if you’ve already set a font in the editor.

ZacB | 2018-08-28 11:35