Custom fonts are replaced in web export

Godot Version

4.2.1

Question

I’m doing web exports of a game prototype just to make sure that it works, but when I do a web export, the custom font I have in my game is replaced with a system default font. How do I make sure the font is included in the game when I export? I have the .ttf and .tres files in the game files, I just can’t figure out how to make it export correctly.

I am assuming you have created DynamicFonts with them and those DynamicFonts are assigned to the appropriate labels or text nodes?

If so, then it may be as simple as this:

[Sorry my last response was outdated]

Make sure you have “Export all resources in the project” selected to make sure the fonts are included within the Export menu, under the “Resources” tab

I’m using a SystemFont to assign the font to all of the UI elements.
Here’s the settings I’m using to export:
image

And here’s the options menu, since I can only put one picture in each reply:

Downloaded 4.2.2 to see if it works there, no luck.

I just figured it out! I was using a SystemFont instead of a FontFile. Basically, I was telling Godot to look for an installed font on my OS instead of looking for a font file in the game files. That’s why it looked fine in the editor, but broke as soon as I exported it.

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