How do I vertically center a font?

0 favourites
  • 2 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • I am having some issues with the Font component. At the moment my game has some buttons with text centered inside them. I am using the Font asset and have set the Horizontal and Vertical alignment both to "center". The font sort of centers, but not quite. Generally, it sits a little bit below where it is meant to, which becomes more pronounced the greater the font size. This seems to apply no matter the font I use (both default fonts and custom imported). Interestingly, disabling "Enable BBCode" causes the font to dramatically move up, but still doesn't vertically center it. See image attached for a visual example of the issue. The font has ample room inside the button, and I have tried increasing the container height in case of padding issues, but it doesn't change anything.

    From my reading around, the solution most people seem to gravitate towards is SpriteFonts, but the font I am using needs to be dynamically sized, so I don't believe that is possible in this case.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Fonts may be rendered differently, so if you need precision, use a SpriteFont. You can change SpriteFont scale.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)