Search Unity

Japanese fonts disappearing at random

Discussion in 'UGUI & TextMesh Pro' started by drHogan, May 12, 2021.

  1. drHogan

    drHogan

    Joined:
    Sep 26, 2012
    Posts:
    201
    Hi,

    Ever since i am localizing my game in Japanese, i feel like dying a bit every day. I already got two negative reviews for slightly mysterious localizations problems i can't seem to reproduce. I will try anyway to post them here, maybe someone has some idea.

    The first negative review came saying that some fonts were garbled and missing and it was very hard to read. On my computer it all looked fine, i tried asking for more details but the reviewer was, well, not so helpful let's say.

    This is the dynamic font I am using, a NotoSerif CJK with multi atlas.



    We tried to reproduce the problem on multiple machines, but nothing, no problems at all. We thought it might have been a problem with the steam update maybe. Then came the second negative review. This time the user sent a picture at least.

    The screen is supposed to be this (at least it is on my computer)



    but apparently sometimes it goes (never on mine) nuts, the fonts disappear until they restart the game, and so all the screens lose the text completely. This is the user picture.



    Now, NotoSerif CJK is my fallback font for asian languages, and use I2 for translations, but it's worth mentioning that the version number in the lower right corner of the picture is not localized in any way, and uses our default IM Fell character we use for western languages. But in the user picture that one has disappeared as well.

    Does anyone have any idea what's happening? Did you ever had any similar problem or experience? It's worth mentioning that I also use NotoSerif CJK for chinese, but at the moment i got no complain yet about it (might have happened, i don't know, but there's no reports about it)

    Thanks in advance
    Cheers,
    H
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Do you know if these issues occurred on some mobile or desktop platform? The reason for asking is related to the use of a 4096 x 4096 atlas texture which might be problematic for some mobile platforms or potential issue with lower end GPUs like integrated chipsets on some desktop or laptops.

    Regardless, for dynamic font assets, I would recommend using atlas textures no larger than 1024 x 1024 mostly because you have Multi Atlas Texture enabled where in the event the first atlas is full additional ones will be created as needed to handle the extra characters. Since changes to dynamic font assets are not persistent at runtime, there is no concern of those growing to some crazy size over time. When a play session begins, they are always back to their default build / shipping state which should be completely empty.

    In addition, given it would take thousands of characters to fill this 4096 x 4096, you end up with a 16 MB texture that sits mostly empty where instead using a 1024 x 1024 would only take 1MB of memory.

    I would also suggest using Static font assets for the known text contained in the project which would include the text for all your menus. To this static font asset, I would assign a dynamic font asset with multi atlas enabled as fallback to handle user input.

    Back to the issue, it is hard to tell but I believe it would be safer from a quality assurance to use static font assets for the menus and dynamic font assets for the rest.
     
    drHogan likes this.
  3. Precache

    Precache

    Joined:
    Jul 30, 2015
    Posts:
    47
    I see something similar to this in the editor frequently. All the fonts will disappear until I reload the scene. But I haven't ever seen it start in play mode (without it happening in the editor first) or a release version.

    Check to see if you have multiple TMP submeshes attached to your TMPros in the editor. Sometimes old submeshes (particularly ones created with old versions of TMP) can mess things up and deleting them can potentially get rid of glitches.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    There were similar issues going back to Unity 5.4 which eventually got fixed. However, it would seem this issue is back in Unity 2021 but not in 2018.4 / 2019.4 and 2020.3.

    There is a similar behavior which is related to text object sharing the same material where these objects are a mixture of normal <TextMeshPro> and <TextMeshProUGUI> object where some of those are in Screen Space Overlay and World Space. That issue has to do with ZTest fighting as Overlay requires different settings than World Space but since the same material is used by all objects, something has to give. The solution for that behavior is to use a separate set of Material Presets for text objects in Overlay vs. World Space.

    Sub text objects in the newer releases of TMP are no longer serialized but as you point out there might be some left overs. So it is indeed best to clean those up; especially in prefabs if they were previously serialized.
     
  5. drHogan

    drHogan

    Joined:
    Sep 26, 2012
    Posts:
    201
    Hi Stephan, thanks for the answer! The target is PC/desktop only, but right after posting yesterday I wondered indeed if the 4k atlas might be a problem. I will give a try to smaller multiple atlases now.

    The static font is a bit of an issue, but please correct me if i am wrong. Our game has a lot of UIs and a total of approx 33k words (UI+dialogs and descriptions).
    Given that we have Chinese, Japanese and we are adding Korean, the menus/UIs (apparently the text disappears for the user in the whole game once it happens) a static font for all the menus and UIs would be fairly huge for the three languages, probably 4k, as i can't force a specific fallback font based on the language chosen (or can I?)

    What would be the advantage of having a base static font for the menus + the dynamic font for the rest vs having only dynamic fonts?

    Thanks again for your time!
     
  6. drHogan

    drHogan

    Joined:
    Sep 26, 2012
    Posts:
    201
    I guess that given how hard it is to get feedback from the users with problems, it might be worth a try as well (but i only seem to have problems in these few "rare" builds and never in the editor myself)
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    My recommendation would be to have a static font asset with appropriate fallback for each language group. That is one static font asset and fallback for your Latin text, another for Japanese, Chinese and Korean. In total 4 sets of static + dynamic fallback for these 4 languages.

    Although your game may contain a lot of text, you might be surprised by the actual number of unique characters in use.

    For Latin text, we can easily fit the extended ASCII in a 1024 x 1024 and that would cover any amount of text.

    For CJK and although these languages contain a lot more characters, it is pretty uncommon to have more than 1,500 unique characters for each of those language.

    I would suggest getting a list of known / unique characters broken up by language group for your project. I know the I2 Localization has a feature to extract unique characters per language. Once you have that number, it will be easier to provide better guidance.

    The main advantage would be performance since all the text contained in the project / menus is already baked into those font assets / atlas textures. It is also better from a QA point of view since again everything is pre-baked.

    P.S. It is also a good idea to include in each of your main font assets the required characters to display the language selection menu in each of those language. If there is no room in your primary font assets or you happen to be using different font files for these languages, you can also include small static font assets that only contain the required characters as fallback to your primary. This is commonly done when the language specific font assets are not included with the game and downloaded after the use has selected one of those languages.
     
  8. drHogan

    drHogan

    Joined:
    Sep 26, 2012
    Posts:
    201
    Thanks Stephan, i will give a try to this approach now. I checked, and Chinese is using 2300 characters, and Japanese is using 1600, but i guess i can create a base static 2048x2048 font for both, and let the dynamic ones handle what doesn't fit in the the static one.
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are those rounded numbers for Chinese and Japanese? It would be pretty strange to have those exact numbers.