How to make RichTextLabel BBCode underline and strikethrough line width thicker?

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

exampleCurrently the text looks like this. I set a custom font for the RichTextLabel of font size 48, and the underlined and strikethrough text don’t look good. How do I fix this?

I am honestly no expert on fonts and there might be a quick solution in code, but the best way to start would be this project: GitHub - Eoin-ONeill-Yokai/Godot-RichTextEffect-SampleProject: This is a test project for the new godot RichTextEffect class. It also comes with some example implementations of custom text effects. View README for details.

and to check out this: CharFXTransform — Godot Engine (3.2) documentation in English

But looking over it quickly there doesn’t seem to be a way to influence underlining or strikethrough text. I guess choosing a different font (or changing the font yourself) would be the fastest way?

1izNoob | 2020-03-15 10:05

I tried opening the scene files in the project and got an “Unexpected end of file” error. But it doesn’t seem it has any way of changing line width regardless.

I changed the font, but the lines stayed the same.alice strikethroughMaybe Godot just doesn’t have support for this kind of thing yet?

exuin | 2020-03-15 18:50

It was pretty long-shot, true. Sorry that it doesn’t work; I can’t open it myself either anymore.

It really does seem like Godot doesn’t have support for this kind of thing yet. Maybe add a feature request on the github page?

Potential solutions I could think of:
You could draw custom shapes in Godot, this page is your friend for that: Custom drawing in 2D — Godot Engine (3.2) documentation in English
It would be a lot of work, but you could do something like add a layer on top of your text and draw shapes that mimic underlined texts and strikethroughs. Not a great solution though, tbh.

A simpler solution might be to have three separate fonts: A normal one, one that is underlined and one that is strikethrough. And then you change the font whenever needed. BBCode does allow you to override the custom font in specific places, I guess that would be the most straightforward approach. You can find lots of tutorials online on making your own fonts, still not a great solution; but I guess an acceptable workaround.

1izNoob | 2020-03-15 19:12

Alright, I’ll try out some of your suggestions. Thanks for answering.

exuin | 2020-03-15 19:39

:bust_in_silhouette: Reply From: Calinou

The underline thickness is currently hardcoded to 1 pixel. There’s a pull request that sources the underline position and thickness from the font metadata, but it hasn’t been merged yet.