#How to scale label depending on label length
28 messages · Page 1 of 1 (latest)
Usually, the label goes under the circle for a profile icon like that
But
To answer your question
You probably want to enable text wrap
Oooor
You put the label inside a container node
And then setup the container to have it's children scale down in size to fit the container
In this case it's for a game and I want their usernames to be inside the profile. Like this except always fitting to the size of the circle
Are those settings in the inspector or do I need to do it through script?
I want to avoid that because then it takes up more of the profile image, just want the text to be in the middle
Hello Godotneers! Building a nice-looking user interface Godot that works across screen sizes and aspect ratios can be quite a daunting task. This video will provide you with the basics that you need to build your very own user interfaces with the Godot game engine that work everywhere. With it you get a good foundation on which you can build in...
This will teach you about Godot UI
After watching that, you should be able to do what you want
Funny enough I actually watched this video already, I don't think it addresses my problem tho
Yes it does. There's a spot in the video where he is addressing text inside a box
It should be basically the same thing
Does that spot in the vidoe scale the text? does it make the text larger if the text is too short?
Good question
Let me double check
I could be speaking out my ass here
Ok you're right. My apologies.
No, not out of the box. I did an implementation to answer a similar question: @tool class_name AutoSizeLabel extends Label @export var max_font_size = 56 func _ready() -> void: clip_text = true item_rect_changed.connect(_on_item_rect_changed) func _set(property: StringName, value: Variant) -> bool: match property: "text": # liste...
I'll give it a try right now
Alright it worked, i'm not very familiar with classes so I have no idea how to use that way but I just ended up removing that, and calling the _set function from the _ready and it's keeping the text within the border so that's good enough for me haha.
Thanks for the links I seriously had no idea what to search up or where to look