How to get support all type of fonts in unity3d textmeshpro

4.1k Views Asked by At

In unity3d text-mesh pro, I'm attempting to render these kind of fonts. However, it is not working; please assist us in resolving this issue.

꧁༺₦Ї₦ℑ₳༻꧂



꧁༺ ₦Ї₦ℑ₳ ƤℜɆĐ₳₮Øℜ ༻꧂


♔〘Ł€Ꮆ€ŇĐ〙♔

꧁༒☬ᶜᴿᴬᶻᵞkíllє®™r☬༒꧂

My output is: enter image description here

1

There are 1 best solutions below

0
On

First, you need to understand that every font can only display a specific parts of the whole Unicode spectrum of characters. (I think there have been attempts at some sort of universal fonts but mostly it's incredibly difficult to have one font that works across, well, pretty much everything from Arabic through Latin to Hebrew and Emojis :D). So it should not come as a surprise that Arial would not cover all those special characters that you're showing in your example.

TextMeshPro only uses the font data that you provide it with. You seem to have a bunch of font assets prepared, so perhaps you already have the fonts that cover these characters. If not, you first need to

  1. Prepare a font that contains the characters in question. You might need to learn which characters you actually need first. You can find the Unicode representation of those characters at https://www.fileformat.info. For example, here's the Naira sign (the starting letter of the Ninja Predator example): https://www.fileformat.info/info/unicode/char/20a6/index.htm. You can follow the 'Fonts that support ...' link on the page of the character for a suggestion on fonts that support those characters. As you can see, Arial supports the Naira sign (which is why it renders for you).
  2. Get the font file. There are multiple sources for this, free fonts and paid options. Remember to always check the license if it's okay to use for your purposes etc.
  3. Create the font asset for TextMeshPro inside Unity. By now you most likely know how to do that but just in case - you can right-click the font file inside the project structure and select Create > TextMeshPro > Font Asset. Then you generate the atlas texture with the character set that you want (in short: Inspector > Update Atlas Texture > specify Unicode ranges > Generate). The Unicode ranges should contain the symbols that you want to cover - they can be whole blocks or just specific symbols.
  4. Now the important part - you need to tell TextMeshPro that it should search the newly created font asset if it can't find the symbols in its main font. You can do this in the TMP settings.asset. There's a Default Font Asset field for your main font asset and then a list of Fallback Font Assets. Add your newly created font asset into this list and save the changes.

If you did everything correctly, TextMeshPro should render your text fully - the characters that are contained in your primary font will be handled as normal and everything that can't be found there will be searched for in your fallback fonts.