godot icon indicating copy to clipboard operation
godot copied to clipboard

RichTextLabel using [i] breaks when setting a Theme Type Variation.

Open IceReaper opened this issue 2 years ago • 3 comments

Godot version

4.0

System information

Windows 11, Vulkan

Issue description

Using [i] in RichTextLabels works. But as soon as i specify a Theme Type Variation the [i] tag does nothing anymore.

Steps to reproduce

Create two RichTextLabel controls. Add [i]test[/i] to both. Assign a Theme Type Variation to one of the two RichTextLabel controls.

Minimal reproduction project

BUG.zip

IceReaper avatar Mar 09 '23 10:03 IceReaper

Well, the issue here is that you've assigned a type variation that is not defined anywhere. You need to have a project theme that defines this variation, and it must have a correct base type specified (RichTextLabel in this case). Without that your control tries to find a definition for the italics font based solely on your type variation name, fails to do so, and uses the default font instead.

Please refer to the documentation to learn about theme type variations. https://docs.godotengine.org/en/stable/tutorials/ui/gui_theme_type_variations.html

YuriSizov avatar Mar 09 '23 10:03 YuriSizov

Thanks for the fast response. The docs were my first place to look for any explanation. However i think this is a typical case on when an issue collides with the request for a minimal example to reproduce.

  • I have a theme
  • The theme has the type variation
  • The type variation inherits RichTextLabel

The output is the same as the above minimum example. Even when I set all the overrides in the editor, none of them affects the font.

I just omitted all that overhead to provide a bare minimum example of the problem, as requested in the issue template.

It would be nice if my example project could be tested and a simple explanation on what did actually fix it would be added. Here is an enhanced version with a theme and variation and still having the same problem: BUG.zip

IceReaper avatar Mar 09 '23 11:03 IceReaper

I haven't checked the new project, but if all those conditions are met, then the issue is probably that the theme is not set as the project theme. Which is a limitation of the current system and so it works like that by design, but I understand how this can be problematic. So I'll keep this issue open in the mean time.

YuriSizov avatar Mar 09 '23 11:03 YuriSizov