Changing the custom fonts in buttons generated in script.

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

I have recently created a working key bind to change the controls, but the buttons and labels are created in the script. currently, they do not fit in with my game and i dont know how to change the font and style of the buttons and labels.

:bust_in_silhouette: Reply From: andersmmg

Method 1
Add a theme to the parent node the buttons are in. You can use this to make all child buttons use the same font. this is the easiest way

Method 2
Create a font and apply it using a script:

var font = DynamicFont.new()
font.font_data = load("res://fonts/font.ttf")
$Button.set("custom_fonts/font", font)

Thank you so much!

godotuser111 | 2020-04-03 17:25