I did some research, and it appears that Tooltips may have some support for some BBCode tags, or BBCode like tags. One of the most common tags is the [code][/code]
tag, as seen in issue 19084 and 24926. I have no idea if custom Tooltips can have these tags.
In issue 19084 it is mentioned that custom tooltip support would be needed. Apparently formatting and tags should be working in Tooltips. The only place I found in the source code that suggests it might be possible to use BBCode like [b]
is this line in the editor inspector source code.
I have not really used Tooltips in Godot though, so I'm not sure what is doable or not. It seems there is some form of BBCode support, but it might be that this functionality is not exposed to GDScript and/or user defined Tooltips.
Edit: Hmm, after some testing, it seems none of the BBCode in the linked GitHub issues render correctly when applied to a Control node through the hint_tooltip
property.
I guess BBCode support for Tooltips is only available in the editor?
Using a custom node for in-game tool tips might be the best solution for proper BBCode support.
Edit 2: It looks like BBCode is not possible through Tooltips set in Control nodes, because the node used to display the Tooltip is just a normal Label
node, not a RichTextLabel. After poking around in the source, I found the code that creates and populates the Tooltip for Control nodes.
In Viewport.h
, line 267 defines the GUI struct that is used for Tooltips. On line 279 is the definition for the Tooltip label. The Tooltip label has it's text set on line 1462 of Viewport.cpp.
It looks like you'll have to use a custom node/scene for in-game tool tips if you want BBCode support within tooltips.