Can BBCode be used to make some words smaller?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hastings

I’m trying to create a joke during a piece of dialogue where a character says something under their breath (like this) and I wanted to make it where the parenthesis text is at a tinier font size than the surrounding text.

I made some progress into fiddling with fonts, and while I learned how to change font size, it unfortunately effects the entirety of the label, and puzzlingly other labels, after doing some research I think the only way this could be done is with bbcode, but I’ve hit a road block where I can’t seem to figure out how to execute on that.

BBCode has a font loader tag, but I can’t seem to even use it to change fonts, let along something more complicated like keeping the current font but changing its size. Are there any good resources on this?

Yeah, in Godot 3, font sizes are tied to the font resource itself. This will be resolved in Godot 4. Using the font tag in BBCode works just fine for me. How are you using it?

exuin | 2022-03-15 22:02

I must not be doing it right. Sorry I erased my old work already since it wasn’t working

I tried something like
Var tinyfont = dynamic_font.new()
tinyfont = load(“path”)
tinyfont.size = 8

And then later the bbcode was [font=tinyfont]blabla[/font]

But there’d be no change in the text

I also tried just importing another font into my project and then put the direct resource path inside [font=whatever path] but this also caused no change

I think maybe I’m just getting the syntax wrong

Hastings | 2022-03-15 22:14

Yeah you need the file system path that starts with res://

exuin | 2022-03-15 23:34

Thanks for the advice, I think it’s something I’ll have to experiment with.

Weirdly I solved my issue completely by accident, when I use a bold tag it causes the text to become much tinier because I don’t have a set font for bold, so that actually solved my issue much more efficiently

Weirdly enough putting the resource in just gave me the error “resource does not have a loader”. I guess my issue is solved? Though I’ll have to do some research just in case I need to know any of this for the future.

Hastings | 2022-03-16 00:02