Pixel Fonts scale

Godot Version

Godot Engine v4.2.1.stable.official

Question

As far as I can tell, there’s little to no information on the subject of pixel fonts in Godot 4.
So, I found a pixel font which is 9px high. I’ve created a FontVariation and set it as default. Then I created a label and some buttons and faced 3 problems:
image

  1. Even though the font is set as default, I need to manually type its size every time.
  2. I’ve selected 18px size which exactlly 2x scale of the original font. It works fine for the most of times. However as you can see in the picture, several pixels in the small letters “s” and “m” got squeeshed.
  3. I’ve set up the spacing between letters by setting Glyph to 2 in FontVariation parameters. However spaces are sometimes 3 pixels wide, which isn’t correlating withe scale of the text.

What could be the workarounds for this problems?

You can tweak these globally by setting a global Theme resource in the project settings. Just search for “theme” and you’ll find it immediately. In the theme resource, you can configure all the ‘Control’ nodes, such as ‘Label’, ‘Button’, etc.

There is a bunch of tutorial for this, but it’s pretty straightforward. In the theme resource, you’ll find the ‘font_size’ configuration, where you can set it as you like.

The font import settings for your font probably might have the “Hinting” and the “Subpixel Smoothing” improperly configured. You can adjust those settings until your outcome gets you reasonable.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.