A way to know if text has been scaled down

As a developer is it currently too hard to tell if scaled text fits within a GUI text element.
.TextFits is not an option as it will always return true (scales down text if its too long).
:GetTextSize() is not an option as it presumes you have a preset text size.
.TextBounds is the only possible way to implement this however it is really hacky to try and get it to work properly.

Since most fonts are not monospaced (meaning each character is equal width), you can’t set an arbritary character limit as it will cause discrepancies where one string may take up all the possible space while another may only take up a third of the possible space. An example where the character limit is 10:
“iiiiiiiiii”
“WWWWWWWWWW”

In order to create a game that works well on multiple different resolutions and devices using Scale is a an absolute must. Using an arbritary font size across all platforms may create experiences where for example on a 4k resolution the text may be unreadable, however on a mobile screen with a small resolution, an unplayable experience as text takes up a large amount of the screen.

It’s currently very, very difficult to tell if text has been scaled down with the currently avaliable api.

My proposed solution is for GUI text object to contain a new read-only property.TextIsScaledDown or method :IsTextScaledDown().

For example, when .TextScaled is set to true, for this text, it will return false:
image
However, for this text it will return true:
image
It would also return true in this scenario:
image

Basically if the scaled text gets scaled down due to the width of the GUI object not being wide enough it will return true, however if it does fit along the X axis without being scaled down it will return false.

If this issue is addressed, it would improve my development experience because it will make setting a text limit on scaled text magnitudes easier, which in turn will allow more developers to create a more fluid, better UX.

8 Likes