Returns the size of the text. A lot of times I’ll need to perform an operation dependent on the size of the text, and sometimes the gui I’m working with may not necessarily be on the screen (textbounds will not update if the text is not displayed). The current workaround is creating a screengui and an invisible textlabel, then setting that textlabel’s properties and reading the textbounds from that. Needless to say, that’s super annoying.
Optional argument forcedWidth for word wrap.
While this would be useful, you can already easily just create a TextLabel, enter text, and check the TextBounds property.
… but it’s not like you have to wait an entire frame for it to compute the TextBounds? I’m pretty sure the TextBounds property changes as soon as you set any of the Text, Font, or FontSize properties. That’s how I’ve been using it and it has been working.
I should not have to hook into some utility function every time I want something as simple as the size of text on the screen. This is already being computed and exposed through TextBounds, it’s not like I’m asking for some huge feature here.
Was just about to ask if this function existed!
This is a very useful function, so instead of creating a new thread I choose to bump this.
Yes please. Anyone who wants to create custom ROBLOX chat has to recreate TextService:GetTextSize() that the core chat uses. There are uses beyond that as well (e.g. GUI audit log I have in-game). This is one of the instances where something needs to be implemented by users repeatedly over and over again, and it should definitely be a feature.
I currently hate working with text because this function does not exist, without it doing basic things is a pain in the ass