godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.15k stars 97 forks source link

Add vertical alignment tags to RichTextLabel #4458

Open nonunknown opened 2 years ago

nonunknown commented 2 years ago

Describe the project you are working on

A Multiplayer game.

Describe the problem or limitation you are having in your project

BBCode currently has the center tag but it only align the text in horizontal.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The solution would be making 2 new tags:

[center]text[/center] -> will align the text in the RichTextLabel Horizontally and Vertically [hcenter]text[/hcenter] -> will align the text in the RichTextLabel Horizontally only [vcenter]text[/vcenter] -> will align the text in the RichTextLabel Vertically only

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

HCENTER TAG image

VCENTER TAG image

CENTER TAG image

If this enhancement will not be used often, can it be worked around with a few lines of script?

as far as I know this cant be made via gdscript

Is there a reason why this should be core and not an add-on in the asset library?

basic functionality

mageowl commented 4 months ago

It would also be useful to have top and bottom align.

dmhagar commented 2 weeks ago

@Calinou This is STILL needed. It is not sufficient to just put a RichTextLabel inside of a control node, ColorRect, etc. Because in the event that you want to have a shader do something like create a glow effect or dust-dispersal type effect on the text, the shader is bounded by the RTL's size, which looks very weird. Since you can't v-center the RTL, it's impossible to just make the RTL bigger so the shader will work properly, which is the obvious (sensible) solution. I think the only way around it seems to be doing something like drawing the RTL onto a separate viewport and then passing the texture from that back to a shader on a parent node, but that's just... so incredibly ridiculous. RTL really should just have clickable halign and valign properties in the Inspector, there's not really any excuse for it not to.