This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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?

Godot version 4.0 release
in Engine by (19 points)

1 Answer

+2 votes
Best answer

Try creating a FontVariation and adjust Extra Spacing -> Top

by (468 points)
selected by

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.