Fit content height broke.

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

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.

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

Ertain | 2021-08-14 00:45

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

Cogan | 2021-08-14 00:53

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.

timothybrentwood | 2021-08-14 01:34

:bust_in_silhouette: Reply From: Cogan

var t : String = rt_title.text;
var m : String = rt_main.text;
font_size = value;
font_change();
rt_title.set_text(t);
rt_main.set_text(m);