Bitmap font: automatic kerning?

Godot Version

v4.3.beta2.official [b75f0485b]


I imported a bitmap file as a font resource. Obviously the differences in width of various characters are very prominent (for example “m” is wider than “i”), so when text is printed on screen, there are large gaps between various glyphs in the body of the text. I’d like the font to be more equally printed.

One option is to define kerning pairs, which’d require me to manually input all kerning pairs together with the amount of pixels. The amount of possible permutations is huge and this is a prohibitive amount of work (especially since I’m no master of font design and it’d take me forever to figure out all the right values).

All I need is to just trim the excessive space at the right hand side of each glyph and print the next glyph at that point. For example in the case of “q”, I’d like Godot to not treat the space after the red line as part of the glyph:

I looked into various font tools but they are mostly geared towards vector fonts that actually have bitmap fonts embedded or are complicated to use. I also tried adjusting various spacings in Godot but such spacings are all applied to all glyphs, so even if I squash the font a bit, the huge gap between “i” and “m” still remains.

Is there a way to automatically trim the excessive space around each glyph in Godot?

I have the same issue in Godot 4.2. I use a pixel art font imported from a png in a grid created from Font Data (Monospace), but I also want to automatically trim the transparent horizontal space between characters to keep always the same characters, because being monospace obviously it keeps a wider tranparent distance with the “i” than with the “w”.

1 Like