I'm instantiating in my main scene a button that is in a separate scene.
I can set it`s position easy in my code.
But I can`t do it for the font size. The error I get is : Invalid get index "custom_fonts" (on base: 'button')
Looking at the documentation for the Button node, I am not sure how the editor is setting the font. Apparently according to the theme properties, you can access the font simply through font, but I think you need to get the theme to do that, which would make the code: theme.font.size = 130.
theme.font.size = 130
Looking at the documentation for Control, there are functions called has_font_override and add_font_override that both look promising, but I have no idea how to use either function and the documentation doesn't say.
Maybe code like this would work? I haven't tested it, but maybe?
export (Font) var button_font
# Other code here!
# Other code here!
button_font.size = 130
But I'm just guessing at how the add_font_override function works.
I am also curious to know if there is a way to access the custom font field like in the editor, as I thought this was already exposed to GDScript through a property.
I know this is old, but in case somebody need this in the future, here is my solution:
$Label.get("custom_fonts/font").size = font_size # Set Font
$Label.get("custom_fonts/font").size # Get Font
Another option is:
This is a method inherited from Control. This will get the font currently used by the node whether you have an override or not. It is also possible to look to the inherited theme from this using the type parameter.
Rich Text Editor.
To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph.
An inline formatting menu will show up when you select text. Hit tab to get into that menu.
Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.