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!

in Engine by (19 points)

1 Answer

0 votes
Best answer

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

by (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.
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 webmaster@godotengine.org with your username.

Categories