changing the font size on a label

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

The below code for changing the font color works fine. I would also like to change the font size. What is the correct syntax? something like:

Font Size Change?

temp_node.add_font_override("font_size", 10)

Font Color Change - works fine

# assembling star count label node name
var node_name = letter + 'StarCountLabel'
var temp_node = get_node(node_path + node_name)
temp_node.text = str(star_count[loop - 64])
temp_node.add_color_override("font_color", Color(1, 0, 1))
temp_node.visible = true
:bust_in_silhouette: Reply From: M.Kh

It works in version 4.0! I don’t know 3.5.
First assign a theme to the label and define the label in it, now activate the font size from the section, now look at the Inspector window and open the theme menu
If you click on your theme, the menu will become longer and at the end of it in the label section you can see the font size, now if you keep the mouse on it for a while you can see its address and control it with this address (like a feature text controlled by $ and .) Example: A label named “Label” in version 4.0 can be changed to:
$Label.Label/font_size/font_size = 23

However, note that any attribute can be changed with this method, so I recommend using the same method to change the color (it may be that by creating this new way to adjust the size of the text, the color you set in the previous method will be ignored So I don’t recommend it)

Thanks for taking the time to answer. Unfortunately that method does not work in 3.5. As a side question, I am working on a fairly large project that is all 2D interface based. With the assumption that 4.0 is a non-backwards compatible upgrade to some degree, is it worth it to stop development and convert over to 4.0 yet, or are there still issues being worked out? It will have to happen at some point, just wondering if waiting a little longer would ease the upgrade to 4.(?)

grymjack | 2023-06-06 12:11