How can i have a RichTextLabel's minimum size be based on visible characters?

Godot Version

4.2.2.stable

Question

i’m using text in different sizes in a RichTextLabel, which should change its own size accordingly; but even if no characters are shown, the label keeps the vertical size of the largest character. is there a way to change its behavior?

While text is present, “Fit Content” should resize the container to match the text. Without text present, you can also use “custom minimum size” under Control>layout in order to set the minimum height, but you will need to calculate this based on font size.

the issue is, using the “fit content” option makes the label’s size fit all the text, even what isn’t displayed (using the “visible characters” property). i’d like to know if there’s an option to only make the label’s size clip to the currently-visible text…

update: it was actually quite easy

image

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.