RichText [TextScaled Support Added]

Priority works depending on the closest enclosing tag for the text.

<font color="rgb(255,255,255)">
Testing
<font color="rgb(255,0,0)" size="10"><font size="16">foo</font></font>
bar
</font>

This would create Testing foo bar where foo is red with size 16, not 10
I don’t think a priority attribute is necessary for tags, if you want to not apply a specific item to a piece of text, you should not enclose it with tags

I admit my use case is very specific (Making commented code override all other syntax highlighting) however an optional int to set the priority would still be appreciated, especially since its optional so shouldn’t inconvenience any other use cases.

This takes place for my favourite update, but will we be able to change the Text Font in the future?

Thanks for the feedback~ We are looking into this issue now. I will add it to the tracking list.

Is Roblox Studio gonna test the new custom font import?

Finally got to play around with the feature today. Took me a couple hours mostly debugging but got syntax highlighting working pretty well.

Though when I add too much text it just gives up…


Not sure if this is an implementation limitation or something going wrong with my code. Either way, pretty nifty.

Still is probably more efficient to split each line into a separate TextLabel; the 200k character property limit, apparent limit to rich text rendering, and the fact that spaces and tabs still don’t render well on multi-line text make this more of a headache than it should be.

8 Likes

Completely agree.

I understand there’s the issue of Copyrighted Material but that’s ROBLOX in general.

If they’re able to monitor: Clothing, Groups, Audio, Images, Places and now videos surely custom font won’t be an overload.

Especially if I can have my account terminated for a Pokémon game created in 2007. That’s all tho.

2 Likes

Text still functions without RichText and it can be disabled if needed :slight_smile:

1 Like

Will there ever be a function that let’s us convert a RichText string to a normal string?

Example:
image

This is possible by using string patterns:

local text = '<b>Test</b> <font size="14" color="rgb(255,0,255)">String</font>'
print(text:gsub("</?%s*[bius]%s*>", ""):gsub("</?font%s*[%w%s='\"\(\),]*>", ""))
-- Output: Test String

Unless this isnt what you mean

5 Likes

Wow! I’m loving these new UI updates. This’ll be huge for UI Designers.

This is really cool, but the way it’s formatted is kinda redundant.
It’s not a very good user experience (go to around 14 seconds)

Have you guys considered doing it in a similar way to how Minecraft does it?

A lot of modded minecraft servers have it like this:
https://www.spigotmc.org/resources/colorcodes.32415/
image

In vanilla minecraft, you use this symbol: §
to add color to book and quills

The main thing that would be nice is a “reset” indicator instead of closing HTML brackets.


Maybe the format could be something like:

image

\<b> Bold Text here → Bold Text here

\<i> Italicized Text here → Italicized Text here

\<s> strikes through Text here → strikes through Text here

and then \<r> to reset


you could do something like this:

\<b>\<255,0,0>Hello \<r>\<i>\<0,0,255>world!

and it would become

image
Hello world!

(The coloring isn’t perfect, but you get the point)

This would save memory in the long run as well since this is shorter than HTML:

<b><font color= "rgb(255, 0, 0)">Hello </font><\b> <i><font color= "rgb(0, 0, 255)">world</font></i>

On the other hand, it wouldn’t be too hard to create a system like this using HTML formatting.
Either way, this is a really cool feature

6 Likes

I’d prefer the current format over that, in my opinion the current one is more easily readable.

2 Likes

I’d tend to disagree, but maybe it’s because I’ve spent an exorbitant amount of time on Minecraft.

1 Like

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