@Sharksie (Sharksie) posted a new topic, subject "Vector2 GuiService:GetSizeOfText(String text, Font font, FontSize fontSize)". It read:

   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.

@Davidii (Davidii) replied

    Optional argument forcedWidth for word wrap.

@Programmix (Programmix) replied

    While this would be useful, you can already easily just create a TextLabel, enter text, and check the TextBounds property.

So @Sharksie (Sharksie) replied

    Ethan:
    
    > (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.

After which, @PlanarTheorem (PlanarTheorem) added

    > (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. [/quote]
    
    … 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.

To which @Sharksie (Sharksie) replied

    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.

@PlaceRebuilder (PlaceRebuilder) replied

    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.

Then @EchoReaper (EchoReaper) said

    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.

@Partixel (Partixel) replied

    I currently hate working with text because this function does not exist, without it doing basic things is a pain in the ass


{'source': 'discourse', 'url': 'https://devforum.roblox.com/t/vector2-guiservicegetsizeoftextstring-text-font-font-fontsize-fontsize/17579', 'title': 'Vector2 GuiService:GetSizeOfText(String text, Font font, FontSize fontSize)', 'views': 378, 'has_accepted_answer': False, 'word_count': 402, 'like_count': 15, 'reply_count': 2, 'participant_count': 7, 'posts': 9, 'tags': '', 'author': '@Sharksie (Sharksie)', 'participants': '@Sharksie (Sharksie), @Davidii (Davidii), @Programmix (Programmix), @PlanarTheorem (PlanarTheorem), @PlaceRebuilder (PlaceRebuilder), @EchoReaper (EchoReaper), @Partixel (Partixel)', 'image_url': [None], 'created_at': '2015-08-11T21:30:05.000Z', 'last_posted_at': '2016-07-12T02:02:54.871Z'}