+1 vote

I have a number (on a Label) that, depending on how many columns and rows my board has, I want to be able to set as a larger or smaller font size.

I know that we can use Dynamic Fonts now, so we don't need to import a font for each font size we want- but how do I modify the font size of a Label from code, so I can set the font size when the board is created?

in Engine by (30 points)

1 Answer

+4 votes
Best answer
get_node("path_your_label_node").get("custom_fonts/font").set_size(100)

...where 100 is your new font size

-j

by (1,486 points)
selected by

and for godot 3.0 how can I change a button font size please?

you could use a theme, follow this video on how to do:
https://www.youtube.com/watch?v=g3p3rtdqCDk&t=608s
-j

thank you jospic, I would have loved to do it the "getnode("pathyourlabelnode").get("customfonts/font").setsize(100)" way but that's ok. Thank you for your reply. Have fun!

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 Frequently asked questions and 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 [email protected] with your username.