+1 vote

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

Thanks

in Engine by (247 points)

2 Answers

+2 votes
Best answer

easy ^^

  $YourLabel.add_font_override("font", load("Your font's path"))
by (178 points)
selected by

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

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.

0 votes

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 :
https://godotengine.org/qa/20870/how-do-you-bring-fonts-into-godot-3-0

by (21 points)

I want to get the font in gdscript, not editor

Thank you

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.