Set font size of label via script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JymWythawhy
:warning: Old Version Published before Godot 3 was released.

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?

:bust_in_silhouette: Reply From: jospic
get_node("path_your_label_node").get("custom_fonts/font").set_size(100)

…where 100 is your new font size

-j

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

mokalux | 2019-02-16 01:01

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

jospic | 2019-02-18 08:12

thank you jospic, I would have loved to do it the "get_node(“path_your_label_node”).get(“custom_fonts/font”).set_size(100)" way but that’s ok. Thank you for your reply. Have fun!

mokalux | 2019-02-18 12:15