Hi,
I’m trying to enable font.runtime_generation in my game.project to reduce build size, but the text doesn’t show up properly.
My setup:
-
font.runtime_generation = 1 in game.project
-
Using a .ttf font file
-
Output Format = Distance Field
-
Material = builtins/fonts/font-df.material
The text appears corrupted or invisible with these settings. If I switch back to bitmap fonts, it works fine.
What am I missing? Is there a specific configuration I might have wrong?
Thanks for any help!
1 Like
Hi @Glen_Dai !
Can you confirm which version of the editor you are running?
Have you added the extension as a dependency? (Runtime font generation documentation)
Note that that dependency will be deprecated from next week going forward.
Next week, we’ll release a much more streamlined solution for this, in our beta release.
I’d recommend waiting for that to arrive, to avoid any extra work.
4 Likes
Thanks for the heads-up! I’ll hold off on the current setup and wait for the new beta release. Looking forward to trying the streamlined solution.
2 Likes
I am using version 1.11.2. I am not entirely sure which method to use for generating fonts. The first method I tried returns an error:
/fontgen/src/fontgen.cpp
Line 219: no member named “ResFontSetLineHeight” in namespace 'dmGameSystem'
219 | dmGameSystem::ResFontSetLineHeight(info->m_FontResource, max_ascent, max_descent);
| ~~~~~~~~~~~~~~^
This error appears simply when adding the dependency: https://github.com/defold/extension-fontgen/archive/refs/tags/0.9.zip
The second method is via Fonts in Defold manual . Error:
attempt to call field “add_source” (a nil value)
It’s strange that this method is not in the API: API reference (Font)
I printed the font and there are only two functions there 
{ --[[0x10eddde80]]
add_glyphs = function: 0x010edddf10,
remove_glyphs = function: 0x010edddf80
}
But even these functions don’t work:
Failed to get font
1 Like
Yes it certainly seems I’ve made some breaking change to the extension/engine with that function.
And it is also true that the editor (1.11.2) won’t build it the same as bob.jar does (keeping the .ttf file)
It’s unfortunate.
I think the best approach is for us to move forward, and suggest the new workflow which we release this week (tomorrow we hope), with the new beta.
The documentation will come up when the beta is released.
2 Likes