1.Fonts Assets are best thought of as containers for fonts. They allow you to import fonts into your projects and create countless variations of a font from a file without ever changing the original. If you want to import new custom or existing fonts into your project, Font Asset Creator lets you package the font into an Atlas, a large texture file that contains characters from the font.
How to use the Font Asset Creator:
1. Create a new folder for custom fonts in your assets directory and copy a custom font into the folder. Fonts can either be downloaded or obtained from your system's font directory.
2. Open the Font Asset Creator by going to Window> TextMeshPro> Font Asset Creator.

We can use many options, some of which may seem confusing at first. Let's break them down: Font Source: Here you can select the custom font that you imported. You can also drag and drop the font from the directory into this slot.
Sampling point size / font size: This determines the accuracy of the SDF (Signed Distance Field) scan when rendering the font. The default setting "Automatic size" tries to fill the atlas with all characters from the font. When set to Custom, higher values result in better playback. In general, a point size of 50 to 70 is a good range. Be careful, however, as too large a sample size will prevent some characters from appearing in the atlas.
Font padding: This sets the size of the effects (outline, glow, bevel, etc.) of writing materials. In general, it is good if the pad size is 1:10 to the sample size. For example, a sample size of 60 should have a pad size of 6. However, this is not a hard and fast rule. If you break this relationship, interesting effects can be achieved that may better fit the aesthetic vision for your project.
Packing method / mode: The method by which the atlas is completed. Fast is good for quickly previewing fonts, while Optimum is best reserved for the final atlas.
Atlas Resolution: The size of the atlas texture. This is determined by the size and spacing of the sampling point. You should limit the atlas resolution to 2048 x 2048 for projects targeting mobile devices.
Character Set: Determines the range of characters to be used in the font. The default is ASCII.
Custom characters: Adds characters from an input field or another font asset.
Custom area: Adds characters from a hexadecimal range.
Unicode area (hex): Adds characters from a Unicode range.
Characters from file: Adds a range of characters from a file. This can be useful for localization or a scenario where filling in an atlas manually would be impractical.
Render mode: Determines how text is displayed. Use the SDF modes as long as the display of text in rasterized bitmaps is still supported, unless you are rendering a small 1: 1 font (i.e. 10pt font which is rendered 10 pixels on the screen) .
Generate font asset: This generates the font texture atlas used by the font asset so that the font is available for use in TextMesh Pro GameObjects.
3. When all the settings are what you want, select Generate Font Asset to import your new font. As soon as your font asset has been created, you can access individual settings in the Inspector.

2. Dynamic and static fonts Sometimes we have to fill a font atlas with certain characters. One practical reason is to create a font from a subset of characters. This is especially useful for languages with massive character sets (over 50.000 for Chinese). Most games use about 1.000 characters or less, and games that fully support the Chinese and Japanese languages are some of the few that approach this range. Dynamic SDFs are an alternative way of filling a font atlas with only the characters we need by typing them into the input field. Font fallbacks are used for all remaining characters as needed. If desired, the font atlases generated by these dynamically populated font assets can be exported, modified to include external characters (i.e., remap "A" to a symbol not in any font atlas), and then reassigned imported into Unity. It's easy to create a dynamic font asset:
Navigate to your desired font within the project hierarchy. Then right click on Create> TextMeshPro> Font Asset.
This creates a font asset with an empty atlas. Click on the newly created font asset. Navigate to the Generation Settings in the Inspector and make sure the Atlas Population Mode is set to Dynamic. Navigate to the TextMeshPro object, select this new font element and enter the desired characters as required. It is good to pack font assets dynamically if you have to fill an atlas at runtime (e.g. for input fields). However, this requires that the source font is referenced and included in the project structure. Static font assets contain characters that you know will be used throughout the project (menu items, dialog subtitles / text boxes, etc.). Because static font assets contain all of the characters required by the project, they do not need to reference the original font source file. In short, you use static fonts for your "acquaintances" and dynamic fonts for your "strangers".
3.TMP settings: The TMP settings asset in the TextMesh Pro> Resources folder is used to assign and manage standard fonts, sprites and fallbacks. While we can apply local settings to individual fonts, the settings in this asset affect every TextMeshPro asset in the scene.


4. Font weight: The font weights describe the different appearances that your font can take on, i. H. Bold and italic. These variations can either be loaded from a new font asset or “faked” using the following settings, some of which are default values.
5.Font fallbacks: Occasionally we want to refer to characters that our script does not contain. Instead of replacing our primary font asset, we can rely on a fallback instead. Fallbacks are additional fonts that are referenced when there is no character in our primary font. Font fallbacks can be set globally in the TMP settings asset or locally per font asset.
6.Multi-Atlas textures: When filling a font atlas dynamically, it can happen that the number of characters exceeds the size of the atlas. In this case, characters that do not match are automatically inserted into a new atlas and assigned to the previous atlas as a fallback. This is the basic principle of multi-atlas textures - the ability to fill in new atlases as needed at runtime. Although they require more memory, they can be useful for localization and provide flexibility for changing atlases at runtime.
TextMesh Pro: Shaders and Material Properties
- Introductory fonts can contain materials like normal GameObjects in Unity. These materials are powered by shaders that determine the visual properties available.
2. The different types of SHadern
Mobile and Standard: Each TextMesh Pro shader includes a mobile variant that is optimized for performance on devices with lower specifications such as tablets and mobile phones. For this workflow you work with the standard variant of each shader so that all properties of each shader are available.
Note: There are no surface shader variants for mobile shaders.
Text rendered with this shader is then not affected by the lighting.
Bitmap: The old standard for rasterized rendering of text. This is useful when you want to render text in a 1: 1 ratio (e.g. on a small mobile device you want a 16-point font to only occupy 16 pixels of the screen). Distance fields signed with distance fields are the new standard for rendering text. This enables crisp, scalable text to be displayed regardless of the target resolution. It also enables the support of effects such as outline, bevel, and glow. In the standard version of the shader, text cannot be influenced by scene lighting.
Distance field (surface): With this variant of the SDF shader, text can be influenced by scene lighting. This is useful for diegetic text that is present in the world of the scene.
Distance field overlay: A variant of the SDF shader that is not influenced by the scene lighting.
sprites: This option adapts sprites to the shape of the characters defined in the font atlas.
3. General guidelines and additional considerations: It is recommended that you always create a new material preset for each font atlas. This distribution level enables better adaptation per atlas. Also, developers are encouraged never to change the default material. The standard material is, so to speak, the “factory setting” of TextMesh Pro. So in most cases it is best not to change it.
Originally posted on 2020-05-21 16:16:00.
