How to build fonts for TextMeshPro

Mopsicus
3 min readApr 21, 2020

For along time already, TextMeshPro is a part of Unity and you can download it and use for free. No need to explain difference between old text component and TMP — it is as compare MS Word and simple text editor.

Default font in TMP supports all common characters, but it is usual and boring like default lens for camera :) To add in your game new beautiful/unusual/bright font you should make few operations.

So, what you need to begin process:

  • Font TTF (OTF), don’t forget to read license☝️
  • Unity with installed TMP
  • Characters list or unicode range, which you will use
  • You should to know, fonts doesn’t contains all characters
  • There is Noto Fonts from Google, it is some boring too, but it supports all languages :)
  1. Add font file to project, open TMP Font Asset Creator and drag font to field Source Font File
  2. Now you can set characters to new font, there is a special menu item Character Set:

All what goes before Custom Range–is ASCII variants and characters. Everything after that–options where you can select characters source: from file, list, range, etc.

3. Select Unicode Range (HEX) and set 0020–007F — is a basic latin characters, other ranges you enter and separate by comma

4. Now you can press Generate Font Asset

Settings window after generation should looks somehow like this:

  • From our range has been added 95 from 96 characters, character 007F — ␡, didn’t added, because it doesn’t contained in that font.
  • In result, for atlas 512×512 generated Point Size = 69, because we stay Auto Sizing option in settings.
  • You can set font size manually, but in this way you have to control size atlas, and if need increase it.
  • Also, you can separate your fonts to few assets, you can make one base with base characters, that uses more often, next with math characters, next with another language, etc. And TMP will load it and use where it need. For that, you should add to base asset all fonts assets to fallback list:

How to make Emoji support in Unity (russian) , I wrote already, and will translate it too. On Unity forum, one comrade published his own solution for fixing “unicode modifiers bug”. Let me remind you, that modifiers still doesn’t works, that is, if you make an atlas with emoji, then all sorts of flags, skin color, etc. will not be displayed correctly. That solution from forum works correctly.

You can find different unicode ranges for your fonts, here.

This article is translation from my blog: https://mopsicus.ru. I will try to translate and write here more often if you like post as this.

--

--