Aligning non-bitmap font to particular leading

Godot Version

v4.2.1.stable.official [b09f793f5]


Godot v4.2.1.stable - macOS 14.2.0 - Vulkan (Forward+) - integrated Apple M1 - Apple M1 (8 Threads)

The interface in my project is based on a particular grid (8 pixels). So I’m trying to make the font follow that too by setting the appropriate settings in the theme used throughout the project. I’m using RichTextLabel for printing the messages to the screen.

Here is what I tried so far:
adding various things under “constants” in theme’s “fonts”
tweaking existing constants of a theme’s RichTextLabel
changing the RichTextLabel’s settings for “normal font size”
… and various other things.

Nothing works. If there isn’t much text, I can make it look somewhat like the font aligns to the grid by punching in some strange numbers (seemingly unconnected to my grid, for example by entering font size “8” and vertical spacing of “-2” for the RichTextLabel) but I don’t get it, why do I have to set “-2” to leading? Is it because the font is not respecting some settings?

Where is this defined? All I want is to set the font’s height to align with the grid.

I dont’ want to use “theme overrides” because this setting has to be project wide.

You could try creating a FontVariation resource using that font as a base and set the extra spacing you need (you can set negative values)