RichText ruins line wrap/break alignment

Reproduction Steps
Any TextLabel with RichText enabled will render an invisible space character after each \n (presumably \r just based on previous related bugs).

This is hugely detrimental because it means that text on new lines no longer align correctly as all their line breaks are now indented by this invisible character but the first line and all dynamic line wraps are not.

Disabling RichText shows that this whitespace character is not actually in my .Text, but simply a bug with how RichText handles it.

Worth noting that this bug occurs regardless of whether you’re utilizing rich tags- enabling RichText on simple content will still get messed up by this.

RobloxScreenShot20220116_151530107

Repro:
Enable .RichText on a TextObject with \n characters in the text. More visible when TextXAlignment is set to Left.
RichTextIndent_Repro.rbxl (36.5 KB)

System:

OS: Windows 10, GPU: RTX 3060, CPU: Ryzen 9 5900HS, RAM: 16GB 3200MHz

Expected Behavior
I expect \n to create a line break with no additional indent (like it does when RichText is disabled) so that it accurately represents the text string it is meant to be rendering.

Actual Behavior
See above. I included an image of the issue and a repro .rbxl for your convenience.

Workaround
No full workaround, but prefixing the text with “\r” at least makes the first line align with the indent, even if all the wrapped lines still misalign.

Issue Area: Engine
Issue Type: Display
Impact: High
Frequency: Constantly

37 Likes

Thanks for your report, this is on the high priority list of bug-fixing right now and we are actively working on it.

9 Likes

It looks like a fix in February was pending from Version 512 that was never enabled.
Seems like this bug may have been forgotten, could you follow up and enable the fix?

2 Likes

Hi, I tried to turn on that fix but it triggered some crashes. We are working on a refactor of the pipeline and it would fix the issue in a more proper way. While I can bump this and take a look.

6 Likes

I’ve honestly decided against using RichText with TextWrapped until a few bugs are fixed. However, I appreciate the transparency and look forward to an enriched text experience.

2 Likes

Related bug report from a while back, possibly more details:

1 Like

This still occurs as of 11/05/22

2 Likes

Wandering how progress on this bug is going cause it would be great to get it patched as it ruins the use of using rich text.

1 Like

It’s been over a year since this was named high priority. I would hate to see low priority :sweat_smile:

Can we get an update? Even a “this was taken off priority” is better than radio silence.

6 Likes

The bug still persists as of March 2023.
Really sad to see this issue being forgotten about for years despite it needing a fix.

There is a small workaround, when using RichText try to wrap newlines in <font size="0"> !
While it “fixes” the issue, I’m not sure if it’s too reliable, although useful regardless.

@MaciejCreates @zachandmom


3 Likes