Japanese font issue (SOLVED)

I have added three Japanese fonts to my game, this is one of them:

These are the glyphs used:

スくきウ原最新あ停使シ秒終らダみ近こ一チパキる今ュ備楽バ削け広難間ッビ記りオぐて長続日試J入教m1ラ倍準いとわ?フ!れア設デ約u利タ購ト…行せ ?復戻ドベイえまレー開無はもすどサ解さ定ロ告ワジ返溶氷草敵再押規の止んコリ元困公除し生ポをゲたン用jっ中信プ0録でブャルか時ィがク了送2完回p

I get this error:

ERROR:RENDER: Out of available cache cells! Consider increasing cache_width or cache_height for the font.

Since the cache_width and cache_height are 0, I imagine the bitmap produced is too big.

What are my options to fix this? Using a bitmap font instead of a distance field? Leaving “Extra Characters” blank?

Edit: The issue happens because of the workaround mentioned in this post:

I suppose a stutter is slightly better than a broken game, so for now I’m going to have to disable the workaround.

Cache width/height documentation: https://defold.com/manuals/font/#properties

“If set to 0 the cache size is set automatically.”

So it could be that the generate font cache becomes too big. What if you reduce the font size and try again (yes, stuff will break, but as a test)?

1 Like

Stumbled on this one again whilst adding translations for a new game, so I did a little digging. It turns out the issue only happens when the text is displayed on screen.

This means that the glyphs aren’t cached before the text is displayed, which is a likely cause of the stutter problem mentioned above. It also seems that the text becomes uncached when the collection is removed, which explains why keeping a text field with all glyphs visible att all time fixes the stutter issue.

Yes, the error happens if the font size is too big and is resolved if the font is made smaller. In my tests setting the value to 0, 0 breaks earlier than setting it to 2048, 2048.

If cache_width and cache_height is set to 0, what is the upper limits before the “Out of available cache cells!” error happens?

In this test project font size 100 works, size 101 breaks with automatic caching: JapaneseGlyphs.zip (3.9 MB)

If cache_width is set to 0 we default to 1024. If cache_height is 0 we guess a height, up to 2048:

1 Like