This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

For the tool I am building, I have to change the font size of a rich text label (it has to be rich text) through code. However, fit content height breaks when I do this. I looked it up and this is a known issue with the engine. If anybody knows a way to fix it or a good alternative it would be appreciated.

Godot version 3.3.2
in Engine by (59 points)

How is the height broken, exactly? Could you give an example?

It acts like it's the size of the original font. It doesn't matter though. All you have to do is set the text to nothing, wait two frames, and set it back to what it was

Hmm I think I've encountered something in this realm before. Try using call_deferred() or set_deferred() to change the text and see if that fixes your issue.

EDIT: if possible try setting the node invisible, then set the text, then set_deferred() the node back visible. That was roughly my solution when I had an issue scaling control nodes.

1 Answer

0 votes
Best answer

var t : String = rttitle.text;
var m : String = rt
main.text;
fontsize = value;
font
change();
rttitle.settext(t);
rtmain.settext(m);

by (59 points)
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.