Problems with custom made fonts in Godot (kerning, height)

Godot Version

4.6

Question

I'm porting an (unfinished) game from Unreal to Godot and I'm noticing weird things with the font. First, I thought it was my fault (still might be) because I used some Mac app about a decade ago to create it, but now that I fixed the initial issues using FontForge, I'm seeing newissues in Godot, and when I test the updated font in Unreal, itstill displays just fine! (It also displays fine in the built-in font viewer app in Gnome.) Godot is the only place I'm having problems...

My initial issue was that there was a big empty space above my font at all times.

This was not as prominent in Unreal, and not immediately visible in FontForge. However, I could see why the issue existed and corrected it.

Before fix.

After fix.

However, after the fix, the kerning went completely crazy in Godot!

And testing the fixed font in Unreal, still no issues.

And both FontForge and the Fonts app in Gnome don’t display any kerning issues on the fixed font either.

Has anyone experienced issues like this with Godot? Is Godot just very picky with how a font is constructed? The original font was made in 2014 on some Mac App and exported as OTF, and my fixed version I'm making on FontForge in Linux and exported as TTF. Guess I'm going to have to study how to do kerning properly now.

1 Like

I’ve a vague (possibly incorrect) memory that mac and windows used different kerning tables inside TTF? I could be wrong.

1 Like

So, I used this tutorial and re-did the entire kerning, but still Godot didn’t like it… until I noticed that the Opentype CFF export didn’t save a CFF file as I thought but rather an OTF file… :sweat_smile: and now finally things look as expected!

Thank you for putting me on the right track! :folded_hands:

(Hopefully, Godot’s font support will be come more robust and forgiving in the future, like the built-in OS apps and Unreal.)

1 Like

Spoke to soon… now the height issue is back (because I’m back using OTF)…

Luckily, someone on the Godot Discord (thank you) showed me that you can create a FontVariation and in the extra spacing input a negative number to get rid of the weird empty space on the top.

But I’m really quite miffed about Godot’s font support now. Again, hope it improves in the future!

I must say, after having created custom kerning for all of my glyphs… I’m quite sure they get mostly ignored by Godot, despite these settings…

And custom width on white space (U+0020) seems to work with TTF but not OTF… but TTF reintroduces height issues that OTF does not have.

I’m silly.

I was using Unreal to verify the kerning and font sizes so much that I forgot that Godot copies the fonts to its local folders when you drag and drop to import, and any re-import gets done from that copy and not the original file (unlike Unreal).

So, there’s some font height rendering issue between OTF/TTF, but the kerning issue was a result of me reimporting on the “wrong” file.

:man_facepalming::man_facepalming::man_facepalming:

2 Likes