Because I included a space in the string itself, the TextLabel shifts the second word to a new line.
Is there a way to prevent this from happening?
I can provide more info if needed.
I’m trying to keep my text scaled based on screen size.
Disabling text wrapped will make the text appear as extremely small on very big screens,
which is what I want to avoid.
TextWrapped and TextScaled are both enabled in the two examples in the original post.
Disabling TextWrapped automatically disables TextScaled and disabling TextScaled but not TextWrapped will give the same result shown in the gif “Without text wrapping”.
If you are also using a constraint to set limits on how big or small your text can be, and add a space inbetween a character, you will experience the same issue I’m having.
It’s also worth mentioning that even when I set the minimum text size on the constraint to 1, it will still show the same result from the original post.
I currently don’t believe it possible to scale text without wrapping using UI elements alone.
Here’s some code to achieve what you want - If the width of the calculated text bounds exceeds the width of the textlabel size, the height is adjusted to fit in the box.
This was just done in a few minutes, so I’m sure you can avoid some of the calculations, such as removing one of the TextService:GetTextSize() calls altogether.