0 votes

Hey guys!

I'm trying to adjust a label.rect_size.x (I'm making a dialog box) relative to the size of the a text inside a it. More precisely, I want the rect_size.x to be the minimum needed size to display the text. I'm using this code :

label.rect_size.x = label.get_font("mono_font").get_string_size(label.text).x 

But the get_string_size() returns a pretty small number and the text does not if in the label (letters are missing). Is the size returned in pixel? Maybe I'm not actually getting the good font? (I have a custom mono_font on my RichTextLabel, I did not find any other way to get the font from my label).

Thanks!

asked Apr 14 in Engine by Darenn Keller (19 points)

1 Answer

0 votes
Best answer

Ok, seems like I used the wrong font ;) With "normal_font" it is working as intended.

answered Apr 15 by Darenn Keller (19 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 How to use this Q&A? before posting your first questions.