"Unable to add character to font asset's atlas texture"

Unable to add the requested character to font asset [DroidSansFallback SDF]'s atlas texture. Please make the texture [DroidSansFallback SDF Atlas] readable.

We are getting the above warning all over the place (each time the font is called).
The font works properly, and the atlas seems to be in the correct place...
How can we resolve this massive error spam?

8598321--1153347--image.jpg

[quote=“CwalRoo”, post:1, topic: 900612]
Unable to add the requested character to font asset [DroidSansFallback SDF]'s atlas texture. Please make the texture [DroidSansFallback SDF Atlas] readable.

We are getting the above warning all over the place (each time the font is called).
The font works properly, and the atlas seems to be in the correct place…
How can we resolve this massive error spam?


[/quote]

The above message is displayed when the atlas texture of the font asset is not set to readable.

You can verify the state of this flag by selecting the atlas texture of the font asset in the Inspector in Debug Mode as seen below.

8603838--1154454--upload_2022-11-21_15-1-39.png
Selected the atlas texture of the font asset.

8603838--1154457--upload_2022-11-21_15-2-20.png
Set the Inspector to Debug mode.

8603838--1154460--upload_2022-11-21_15-2-54.png

Check if texture Is Readable.

NOTE:
While reviewing your post, I noticed that your atlas texture is set to 8192 x 8192 which will result in significant memory overhead and is likely unnecessary given your font asset Generation Setting and relatively low sampling point size.

Instead I would recommend setting the Atlas Width and Height to 1024 x 1024 with “Multi Atlas Texture” and “Clear Dynamic Data on Build” enabled.

The “Multi Atlas Texture” option enables the font asset to add new atlas textures as needed when the main 1024 x 1024 is full. This option makes it possible for a dynamic font asset to display every character contained in the source font file.

The “Clear Dynamic Data on Build” option, clears the Character and Glyph tables when creating a build or closing the Editor. It also reset the Atlas Texture to size zero where its contribution to build size will be marginal. At runtime, when trying to add the first character and glyph to the atlas texture, we check if the atlas texture is uninitialized (ie. size zero) and if so it gets resized to the specified size in the Generation Settings.

Let me know if you have any questions about the above?

3 Likes

[quote=“Stephan_B”, post:2, topic: 900612]
The above message is displayed when the atlas texture of the font asset is not set to readable.

You can verify the state of this flag by selecting the atlas texture of the font asset in the Inspector in Debug Mode as seen below.

Selected the atlas texture of the font asset.

Set the Inspector to Debug mode.

Check if texture Is Readable.

NOTE:
While reviewing your post, I noticed that your atlas texture is set to 8192 x 8192 which will result in significant memory overhead and is likely unnecessary given your font asset Generation Setting and relatively low sampling point size.

Instead I would recommend setting the Atlas Width and Height to 1024 x 1024 with “Multi Atlas Texture” and “Clear Dynamic Data on Build” enabled.

The “Multi Atlas Texture” option enables the font asset to add new atlas textures as needed when the main 1024 x 1024 is full. This option makes it possible for a dynamic font asset to display every character contained in the source font file.

The “Clear Dynamic Data on Build” option, clears the Character and Glyph tables when creating a build or closing the Editor. It also reset the Atlas Texture to size zero where its contribution to build size will be marginal. At runtime, when trying to add the first character and glyph to the atlas texture, we check if the atlas texture is uninitialized (ie. size zero) and if so it gets resized to the specified size in the Generation Settings.

Let me know if you have any questions about the above?
[/quote]

Thank you for the response!
After checking the box to make it readable, it appears the errors stop, but the font also seems to stop working:

Also, thank you for the advice for the size of the atlas, the thing is I don’t get how you do multi texture with the Asset Creator. If I select 1024*1024 only a few of the character are taken in consideration out of the 28K I’ve in range (it’s the full fall back for non-classic-latin alphabets, as we support Simplified Chinese, Korean, Japanese etc…) I saw where to check the multi atlas texture on the already-made asset, but not beforehand.

The only thing that was changed was the “Is Readable” selector.

You cannot do multi atlas texture with the Font Asset Creator. Ie. have the Font Asset Creator create more than one atlas texture. This is perhaps a new feature that could be added in the future.

Having said that, since your font asset is Dynamic, you do not need to try to add any characters to it since those will be added at runtime dynamically.

A Dynamic font asset with Multi Atlas texture enabled will make it possible to handle every single character and glyph contained in the font file at runtime. As one atlas texture gets filled up, a new one gets created as needed for the additional characters.

The only thing you have to keep in mind is that dynamic font asset have a higher performance overhead vs static as we need to add characters and glyphs at runtime to the font asset and atlas texture(s). On the other hand, this higher performance overhead is still much faster than any human can type so using dynamic font assets to handle user input is ideal. Where it is not ideal is when you go from an empty dynamic font asset and you try to display a large amount of text right from the start like a large dialogue screen or license agreement.

The recommended workflow in terms of the use of Static and Dynamic font assets is as follows:

Static font assets should be used for all known text for any given language or groups of languages. Known text is all the text contained in your menus, UI, dialogues that is known at build time.

Most of the time, the known text for any given language is not that many characters even for CJK unless you are creating a novel or text adventure game. Typically, you will have one static font asset for Latin text and one for Japanese, another for Korean and lastly one more for Chinese. Depending on the amount of text, both Chinese Traditional and Simplified can fit in the same static font asset. Most of the time, a 1024 x 1024 atlas texture size will work with good sampling quality.

Each of these static font assets should have a local fallback that is dynamic to handle any unknown characters coming from user input for instance.

Adding new characters and glyphs to any of these dynamic font assets as users are typing will be noticeable by them as although this performance overhead is significant on low end devices, it is still much faster than they can type.

Be sure to use the same Sampling Point Size to Padding ratio between the Static and Dynamic Fallback font assets. There are several threads / posts on the forum about this topic.

[quote=“Stephan_B”, post:4, topic: 900612]
since your font asset is Dynamic, you do not need to try to add any characters to it since those will be added at runtime dy
[/quote]

Is there a reason that the Font Asset Creator doesn’t just turn on the “readable” (which really means writable) flag when you have the Font Asset marked as Dynamic? Spamming the user for something that is only visible on a Debug Inspector seems a bit strange.

5 Likes

Yes, it's very annoying. In Fact, I was at one step to do a bug report, because it's definitely not normal.

It seems that when saving from the Font Asset Creator, "Is Readable" is turned off every time.

3 Likes

In my case, I explicitly do NOT want to enable the IsReadable flag, because I want the font to use a fallback font for some characters intentionally. If I mark it as IsReadable, the non-fallback characters get added to the atlas at runtime, preventing the fallback from being used. Is there any way for me to suppress the warning?

Edit - I was able to suppress the warnings by setting the Atlas Population Mode under Generation Settings on the font to Static, just need to make sure your atlas already contains all the characters you need for your project manually or before making that change.

[quote=“UDN_0ad8ee55-a39d-4282-82fb-4a7f7379ee07”, post:8, topic: 900612]
In my case, I explicitly do NOT want to enable the IsReadable flag, because I want the font to use a fallback font for some characters intentionally. If I mark it as IsReadable, the non-fallback characters get added to the atlas at runtime, preventing the fallback from being used. Is there any way for me to suppress the warning?

Edit - I was able to suppress the warnings by setting the Atlas Population Mode under Generation Settings on the font to Static, just need to make sure your atlas already contains all the characters you need for your project manually or before making that change.
[/quote]

Hey, thanks a lot for the solution! :smile:

[quote=“Uman06”, post:9, topic: 900612]
Hey, thanks a lot for the solution! :smile:
[/quote]

Don’t just reply to a thread say thanks. Click the Like button instead.