How to change text size using BBcode in RichTextLable?

Godot Version

4.0.2 stable

Question

Hello community. Lately I’ve faced with one unpleasant problem. For some reason i cannot change size of a text using “[size=]…[/size]” in code. I would be very greatful if you could give me the suggestion of this issue. Oh, and also is it possible to make the same shadow like the line has above the common text in the screenshot? Thank you all in advance :smiling_face:

screenshot:

code:

extends RichTextLabel

func _ready():
	var rich_text = "[font=res://SuperLegendBoy-4w8Y.ttf][size=9][color=blue]Mobility:[/color][color=white] medium (3/5)
	[color=red]Defence:[/color][color=white] medium (cannot stun
	but can cause damage) (3/5)[/color]
	[color=green]Vitality:[/color][color=white] 5/5 (has a shield)[/color]
	[color=yellow]Support:[/color][color=white] 2/5[/color][/size][/font]"
	
	text = rich_text

Use [font_size=9]
Docs
Alternatively you can use [font size=9]hello[/font]

2 Likes

Thanks, it worked :pray:

But I still wonder whether i can add shadows like ordinary label node has using bbcode in RichTextLabel? I found nothing related to shadows in the documentary you attached :confused: