ProBaturay
(Programmer)
November 6, 2021, 2:22pm
#1
Reproduction Steps
Download this file Reproduction For RichText.rbxl (153.2 KB)
Inspect the text of the TextLabel of SurfaceGui , whose parent’s name is PartForReproduction , located in Workspace.PartForReproduction.SurfaceGui
Look at the text on the part. Texts do not seem to align correctly comparing the ContextText
property and the text on the surface of the part.
Expected Behavior
There ought not to be an indentation at the beginning of each sentence following the characters <br/> and \n .
Actual Behavior
Every time those characters are used, there’s an indent whose size is kept up in accordance with the actual text.
Workaround
Wrapping each <br/> line breaker (not \n anymore due to an exploit patch recently) with the font tag its size option set to 0 resolves the issue temporarily, proposed by @chess123mate in RichText property ignores the first space after <br/> or \n characters - #6 by chess123mate Yet it is irritating to implement it for every character.
Date First Experienced: 19:20:00 (UTC+3) 10-06-2021
Date Last Experienced: 02:18:00 (UTC+3) 08-25-2022
Issue Area: Engine
Issue Type: Display
Impact: Medium
Frequency: Constantly
3 Likes
Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.
2 Likes
blockleman
(blockleman)
December 26, 2021, 9:17pm
#4
Any update? Been dealing with this issue for many months now
dukzae
(dukzae)
July 22, 2022, 9:16pm
#5
(cc @pjhinthehouse , @EmesOfficial , @MaciejCreates , support bug topic)
This issue has been occuring for a very long time now. The following images demonstrate the issue. Beyond the first newline character (\n
or <br/>
), a space/whitespace appears as the first character for every succeeding line.
Enabling RichText on a TextLabel creates unexpected spaces beyond the first newline (\n) character.
Without RichText
[Screenshot 2021-11-01 205642]
With RichText
[Screenshot 2021-11-01 205702]
There are no tags on the text, it is simply raw text.
I rely on RichText to adapt to the DevForum’s markdown (as I am porting text directly from it). Beyond the first header, it creates a weird effect where each line afterwards is followed by a space or some form of whitespace, which is not the be…
3 Likes
Was having this issue for a while, but just discovered a work-around!
label.Text = string.gsub(text, '\n', '<font size="0">\n</font>')
(If you’re using <br/>
you should find/replace that instead of the newline character, of course.)
[EDIT: Note that if you have multiple newlines in a row, this will reduce their line height to 0!]
dukzae
(dukzae)
August 24, 2022, 4:06pm
#7
Thanks for finding a workaround. Just to clarify, \n
and br/
both point to the same newline character, so they can be used interchangeably.
That’s only the case after you give it to a TextLabel with RichText on; as you prepare the text, keep in mind that Lua(u) treats them differently:
print("\n" == "br/") -- false (but probably not what you meant)
print("\n" == "<br/>") -- false
print(("A\nB<br/>C"):gsub("\n", "!")) -- A!B<br/>C 1
If your string has both “\n” and “<br/>
”, this works:
label.Text = string.gsub(string.gsub(text, "<br/>", "\n"), "\n", '<font size="0">\n</font>')
dukzae
(dukzae)
August 25, 2022, 2:31pm
#9
Only if it hasn’t already been formatted. If your string contains br/
(non formatted), then sure, you can substitute. Otherwise, if your newline characters were already contained in the string, it doesn’t matter whether you use \n
or br/
system
(system)
Closed
May 23, 2023, 2:25am
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.