Change in TextLabel behavior causing text to render improperly

Summary
I don’t know the details, but what seems to be a recent change to the TextLabel has caused text to display improperly. Some text that was fine beforehand has been shifted and some text is missing. There seems to be issues with text ever so often and it’s getting annoying at this point. The difference this time is that it does not seem to be connected to RichText (as the affected text does not have this property enabled). The main difference, however, is that possible causes are unknown. This issue is observed both in-game and both in and out of RunTime in Roblox Studio.

Reproduction Steps
Unsure at this time

Expected Results
Text should display properly as they did before

Actual Results
Text is being shifted or not being displayed

Screenshots


image
^ The screenshots above show text that normally display fully in the way that it is set up, but some change or bug has caused them to be shifted upwards (which is being purposely cut off by ClipsDescendants).

^ The screenshot above shows how this text saying “Not In Service” (see properties menu in same screenshot) was modified in some way and is no longer displaying “Service” at all. This used to display fine until recently.

Not sure if this is related (it might be), but the text on this has also been altered somehow. The size and position of the TextLabel seems to have been modified, or at least the way the text displays has been altered somehow, as it definitely wasn’t like this before, and it has not been touched.
image

4 Likes

I noticed this in other games. Like for example, text that said “Like The Game!” instead said “Like The”. And in my game, where the textlabel had automatic size, said “ski” instead of “skip”.

3 Likes

I noticed you set a LineHeight property for the TextLabel in your screenshot. The offset is likely due to a recent fix regarding LineHeight (see post for a way to adjust text). This property was fixed so that it only scales the spacing between lines and not the spacing above the first line as per definition. This will require some adjustment to non-RichText TextLabels with LineHeight not equal to 1.

3 Likes

Can you provide some specific experiences that this affects to help us look into this issue?

2 Likes

Pet Simulator 99 (not my game)

image

Expected text (I saw it before): ❤️ Like The Game!. Not seeing the issue anywhere else there, though.

I can’t reproduce the bug in my game anymore!

2 Likes

I checked Pet Sim 99 and it seems like the issue is fixed from what we can tell. Please let us know if you see any other instances of this behavior!

Screenshot 2023-12-13 at 9.52.00 AM

3 Likes

In other words, this is now the intended behavior as opposed to how it was before? Can you provide any details of the issue that had existed before this?

1 Like

Yes, that’s correct this is now the intended behavior. The previous issue was that changing the LineHeight was incorrectly calculating the TextBounds as it was scaling every line by the LineHeight rather than the space between the lines which is 1 less than the total lines. This is how LineHeight is defined across other text editors as well. For example, a TextLabel with a single line of TextSize 10 and LineHeight 0.5 would have Y bounds of 5 even though it should just have bounds of 10. This was causing other issues where TextLabels with LineHeight not equal to 1 were not vertically aligned.

2 Likes

Did this fix include automatically adjusting text size and position?

1 Like

The LineHeight fix will change the y position of a non-RichText TextLabel/Button with LineHeight not equal to 1. There were no changes to the size of the text directly, but could change if the TextBounds were used to calculate the size (also for LineHeight not equal to 1). Are you noticing these changes even when your Text objects have LineHeight of 1?

2 Likes

I don’t believe so. What I am noticing is a change in both size and position which is causing the issue. I have not noticed any actual visible change in the behavior of LineHeight. The only change is the size and position which has caused the offset, and in some cases, shrinkage, of text.

1 Like

After viewing the associated files, we confirmed that the offset/shrinkage was caused by the recent LineHeight fix. Since the affected text had a LineHeight not equal to 1 and RichText false, this caused offset changes when the fix was added. This can also affect shrinkage when combined with other text properties. So these changes are as intended, and may require adjusting to revert to previous behavior.

1 Like

Thanks for investigating. I was wondering if this shift was necessary in the first place, though, as I did not observe any change besides this offset.

Previously, text with LineHeight not equal to 1 had an incorrectly calculated TextBounds.Y, which was causing other UI to break. We fixed this issue and as a result, this also fixes the offset since the TextBounds.Y is correct now. In your case, it was only a Y offset that didn’t affect anything else, but for other cases, it was causing text not to use all available Y space and even one line of text with LineHeight did not appear centered (LineHeight should have no effect on a single line of text since LineHeight should only affect the spacing between lines). There was also discrepancies with RichText, which was calculating the TextBounds correctly.

1 Like

Got it. I’m not aware of the other cases with LineHeight, but it seems that was what this was all about. Thanks!

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