RichText [TextScaled Support Added]

Having the exact same issue. Made my syntax highlighter and it was working perfectly.

Tried it on a large script and RichText just didn’t bother rendering…

I thought it was something being escaped incorrectly so I wasted 20 minutes trying to narrow it down to something before realizing that setting the source to string.rep("print('hi');",200,"\n") caused it to break.

20 Lines of syntax highlighted text:

200 Lines of exactly the same thing, simply more RichText tags:

I don’t know what the current limit is but it clearly stops working after a certain number of tags. (Limit seems to change based on how many unique tags there are, but always exists at some cutoff.)

@0xabcdef1234 How many tags does it take before it reverts to being a regular TextObject?

6 Likes

I’ve been waiting for this for a long time, and I’m really excited for the release! This would be perfect for in-game dialog.

Perfect, I was trying to make a luau syntax color thing and this will help me a lot!

ROBLOX IS SPOILING US! I’VE BEEN WAITING FOR HTML IN TEXT FOR YEARS!!!

but what about css in text too?

1 Like

I don’t think there is a limit to the amount of tags, however there is a limit to the length of text stored in a text object.

local t = Instance.new"TextLabel"
t.RichText = true
t.Text = string.rep("A",100000)
print(#t.Text) --> 16384

The rest of the string just gets cut off.
Presumably at the point it gets cut off it makes something invalid which causes it to not render using rich text (removing a closing tag, removing half of a tag and getting something like </font, etc).

You can somewhat alleviate the problem by using a hex color code instead of rgb(...).
<font color= "rgb(131, 206, 255)"> is 34 characters, while <font color="#83CEFF"> is 22 characters.

6 Likes

Ohhhhhh good catch. That’s a shame.

4 Likes

Changing text positions would be cool, and so would being able to change text rotations!

We can give the words a little spin :dizzy:

1 Like

RedText gt BlueText

Love it. Now all we need is custom fonts and I’ll have a field day(or week…or month) with that.

1 Like

After literal hours (around 8 because I’m terrible at string manipulation) of trying to figure out a good string pattern for this (I still didn’t get a flawless one [Edit: I think I fixed all the issues the old pattern had]), I added markdown to my custom chat!

custom

I achieved this by converting the markdown text to rich text, which was a pain, to say the least.
I also had to come up with a solution to remove the rich text before filtering and adding it back afterward, which was painful as well. It’s a pretty hacky solution so a :FilterRichTextAsync() function would be handy.

Here is the same message with the RichText property off. (It got cut off as the TextBounds are calculated on the same string but with the RichTags removed)
1

It even shows up in the chat bubble.

28 Likes

This Is So Helpful When Making GUI’s And Other Things :grinning:

Here’s what I’ve been using RichText for… @PoliceFighter761 great minds think alike, eh?
Also, the GetTextSize(RichText) function would really help in accurately positioning the caret since certain tags (<i>) change the size of the text. Other than that, this feature makes chat so much more fun to use!

24 Likes

hoo boy this is gonna be fun to mess w/

This changes everything/ I’ve been waiting so long for this to come out (Since I started as developer) and it is finally here. Thank you! :smile:

Wait did you script it or was it built-in?

You have to script it yourself, its not too hard actually.

Oh, I thinks its really hard but anyways

Scripted. The entire thing was made from scratch rather than expanding upon the existing Lua chat system.

This is awesome, I can’t wait to see this implemented in games!

I cant wait to see developers using this!

Will there be an ability to add line breaks in TextLabels without having to use a script to put \n in the label?

This addition is really good, it will be extremely beneficial to UI designers.