TextLabel with TextScale breaking lines

A TextLabel with multiple words, TextScale On, and a scale.X < 1 (and some specific fonts), inside a frame with a little scale, will break lines:

Here the project to confirm: TextScale.rbxl (23.5 KB)

1 Like

It happens because TextScaled is coupled with TextWrapped which is the property that breaks the text into multiple lines so it fits the frame

As I said, it’s happening only with some fonts. The behavior should be the same for all fonts.

Hi @rogeriodec_games - it sounds like you’re keeping properties like TextScaled and TextSize the same, and noticing that line break (due to word wrap) will occur just by changing fonts, is that correct?

If so, then that behavior is probably as-designed. Even if you keep the same text size value in Roblox, different fonts have variations in sizing. For example, kerning - the spacing between two characters - can cause sizing differences that affect the total amount of space the text requires on-screen (which also affects word-wrap), and kerning will change from font to font.

Does that sound like what might be happening? Or are there more details to consider for this issue?


1 Like

Here is the thing: in the current example, I use the “GothamBlack” font. With Text Scale On, it breaks the line.
Changing the font to “Fantasy”, it will not break the line. The behavior should be the same for all fonts.
Also, turning off TextWrapped, it also turns off TextScaled; in the opposite way, turning on TextScaled, it turns off TextWrapped.
In short, I’ll never be able to use “GothamBlack” with TextScaled in this scenario.
This is wrong.

TextScale.rbxl (23.5 KB)

Hi @rogeriodec_games - thanks for providing the additional information! It looks like the TextScaled property will implicitly enable word-wrapping, even if its off:

I setup a text label with text scaled, and noticed that Gotham Bold will start wrapping before Gotham. So it seems that TextScaled is probably checking to reach some threshold of how much space the text is occupying within the available space of the text label before choosing to wrap. Fonts that occupy more space (like Gotham/Gotham Bold) will start to wrap before other fonts, simply due to their sizing.

With text wrapping (which TextScaled enables implicitly), different fonts will wrap differently even if they have the same TextSize (you should be able to observe this behavior even with TextScale off).

If you use a UITextSizeConstraint with a MaxTextSize specified, you should be able to prevent TextScaled from wrapping, depending on the size of the label etc. If you know you’re going to use Gotham with TextScaled, will this work? If the font changes dynamically, then you may need a custom script that will adjust MaxTextSize based on the font you’re using.

Would multiple TextScale options resolve this problem for you? For example, if you could specify the axis along which the scaling occurs, in this case you could specify the X-axis (with no wrapping), which means that the text would never use wrapping and always scale down to fit amongst the X-axis bounds of the TextLabel etc. If Roblox were to provide something like that, would that seem like a viable solution to you?

Again, thanks for reporting this!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.