(TMP) Fallback font & multi-language

Hello,

We are trying to support mulitple languages in our game. We are using TMP fallback font assets.

6920657--811856--upload_2021-3-10_15-0-39.png

Here’s what we came with for now.


1 : Text with original font, without the need for the fallback
2 : Text rendered with the original font that has fallback (original don’t have any japanese characters)
3 : Text rendered with the fallback font only (SourceHanSans)

Notice the colon at line 2 : it’s rendered with the original font instead of the Fallback font
Notice the colon at line 3 : it’s what we want

We want to use the same font for all the text if there is a fallback without any missing character.
How can we achieve this ?

I do not have a current solution for this other than using one of the HasCharacters() function as seen below to check if a given font asset contains all the requested characters.

/// <summary>
/// Function to check if certain characters exists in the font asset. Function returns a list of missing characters.
/// </summary>
/// <param name="text">String containing the characters to check.</param>
/// <param name="missingCharacters">List of missing characters.</param>
/// <returns></returns>
public bool HasCharacters(string text, out List<char> missingCharacters)

This is not the first time this functionality has been requested and perhaps something that I could add support for.

1 Like

Well, this looks like a good (needed ? :p) addition to TMP.
Can I patch TMP myself to make this behaviour change easily?

Thanks and have a nice day