UI 丰富的文本 使用简单的标记标签来样式串在 bold, italics, underline, fill color, stroke variations 和更多。 您可以将 стиling 标签应用到 TextLabel , TextButton 和 TextBox 对象。
启用丰富的文本
您必须通过其 RichText属性在 属性窗口中启用丰富的文本,或者通过将属性设置为 true在 Class.LocalScript中。

local title = Instance.new("TextLabel")title.RichText = truetitle.Text = "Use a <b>bold title</b>"
支持的标签
丰富的文本标签与 XML/HTML 标签类似,您必须在格式文本周围包含打开和关闭标签。
<b>Formatted text</b>
您还可以在标签之间相互关闭标签,以反向顺序关闭它们。
<b><i><u>Formatted text</u></i></b>
颜色
<font color=""> </font>
I want the <font color="#FF7800">orange</font> candy.``I want the <font color="rgb(255,125,0)">orange</font> candy.

大小
<font size=""> </font>
<font size="40">This is big.</font> <font size="20">This is small.</font> <font size="40"> 这很小。</font>

字体面
<font face=""> </font>
<font face="Michroma">This is Michroma face.</font>

字体家族
<font family=""> </font>
<font family="rbxasset://fonts/families/Michroma.json">This is Michroma face.</font>

字体重量
<font weight=""> </font>
This is normal. <font weight="heavy">This is heavy.</font>``This is normal. <font weight="900">This is heavy.</font>

击球
<stroke> </stroke>
You won <stroke color="#00A2FF" joins="miter" thickness="2" transparency="0.25">25 gems</stroke>.

透明度
<font transparency=""> </font>
Text at <font transparency="0.5">50% transparency</font>.

大胆
<b> </b>
Text in <b>bold</b>.

意大利语
<i> </i>
Text <i>italicized</i>.

Underline
<u> </u>
Text <u>underlined</u>.

击中
Text with 条纹通过

行线分割
<br />
New line occurs after this sentence.<br />Next sentence...

大写
<uppercase> </uppercase>``<uc> </uc>
<uppercase>Uppercase</uppercase> makes words read loudly!``<uc>Uppercase</uc> makes words read loudly!

小帽子
<smallcaps> </smallcaps>``<sc> </sc>
My name is <smallcaps>Diva Dragonslayer</smallcaps>.``My name is <sc>Diva Dragonslayer</sc>.

标记
<mark> </mark>
Text <mark color="#009966" transparency="0">highlighted</mark>.

评论
<!-- -->
After this is a comment...<!--This does not appear in the final text--> and now more text...

逃离表单
如果您想要渲染特定角色,例如 < 或 > ,并将其从考虑中免除,作为 rich text 标签的一部分,您可以在其 escape 形式 中写入它们。
Personagem | 逃脱 | Exemplo | Resultado |
---|---|---|---|
<) | < | 10 < 100 | 10 < 100 |
> | ><1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1<1< | 100 > 10 | 100 > 10 |
"título de exemplo" | " | Meet "Diva Dragonslayer" | Conheça "Diva Dragonslayer" |
“ | ' | Diva's pet is a falcon! | Animal de estimação da Diva é um falcão! |
& | & | Render another escape form <b>&lt;</b> by escaping an ampersand | Render outro formulário de fuga < ao escapar de um ampersand |