Using multiple `.ttf` files of different font weights

Godot Version

v4.6.2.stable.official [71f334935]

Question

I have 4 different .ttf font files.

  • DejaVuSansMono.ttf (Regular)
  • DejaVuSansMono-Bold.ttf (Bold)
  • DejaVuSansMono-Oblique.ttf (Italicized)
  • DejaVuSansMono-BoldOblique.ttf (Bold and Italicized)

In a RichTextLabel I have the following text contents.

Hello, [b]Username[/b]!

I would like the text to display in bold. How do I merge my font files so that this works?

I tried merging the .ttf files into a single .tfc file but it displayed the same font weight for both the regular and bold text. I tried using FontVariation but there didn’t seem to be a configuration option that was of any use (variation coordinates seemed like it could be useful but I think the font didn’t support it because the list was empty). I tried using font fallbacks but it would always default to the base font and ignore the fallbacks.

Not really sure what I can do next other than changing the font but I’d like to understand how to fix the problem in-case I run into it in the future. I’m not particularly attached to this font.

If you want to see the fonts yourself, you can download them here.

I’ve been looking in the wrong places. RichTextLabel has theme_overrides that let you set the fonts for bold text :sweat_smile: