Correcting vertical alignment center for a label

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

I am working on pixel-art game. I’ve created a custom style for my gui elements. Of course everything is based on the StyleBoxTexture. For the font I am using a 16-sized, non-anti aliased, pixelated font. When I create a Label and set it’s Vertical Alignment to Center I get a font which is shifted too high, as if the line height was wrong, or the inner part of the button was wrongly calculated.

Bottom:
Alignment center

Center:
Alignment center

Is there a way of dealing with this issue, apart from writing a custom Label node where I would draw the background myself and create a text-only label correctly positioned?

:bust_in_silhouette: Reply From: aidave

Try creating a FontVariation and adjust Extra Spacing → Top

Increasing the top of Extra spacing made the button oversized, but making bottom go negative fixed the issue. Thank you for help.

red1939 | 2023-03-10 21:25