For CJK font asset, it set atlas size is set to 2K, however it occupy to much space in the build. So, can I set it to smallest and increase the size in runtime ?[ICODE][/ICODE]
The size of the atlas is determined when you create the font asset.
By default it is 1024 x 1024 which can be changed in the Editor via the Generation Settings or when creating a font asset at runtime via
public static TMP_FontAsset CreateFontAsset(Font font, int samplingPointSize, int atlasPadding, GlyphRenderMode renderMode, int atlasWidth, int atlasHeight, AtlasPopulationMode atlasPopulationMode = AtlasPopulationMode.Dynamic)
When font assets are created or reset (via the context menu), the atlas is set to a size of zero and only resized to their defined size when the first character is added. As such when including dynamic font assets / fallbacks, they will not materially increase the build size since their texture is zero x zero. (Assuming you Reset them before building).
Currently font asset only have a single atlas texture, in the future release of TMP (version 1.4.2 for Unity 2018.3 and 2.0.2 for Unity 2019.1) Multi Atlas Texture support will be added allowing font assets to have multi atlas textures which are created as needed.
When I use dynamic sdf , How can I detect character is over altas size?
Have any event ? or somthing? or use “TMP_FontAssetUtilities.GetCharacterFromFontAsset” this api to check ?
because if atlas is full , I want to create a new dynaimic Font asset at runtime to handle that .
In the latest release of the TMP package, a new feature was added called Multi Atlas Texture which will automatically add new atlas textures to handle glyphs that do not fit in the current atlas.
This feature is enabled per font asset in the Generation Settings.
The latest release of the TMP package is version 1.5.1 for Unity 2018.4, version 2.1.1 for Unity 2019.4 and version 3.0.1 for Unity 2020.x.
Thanks your answer . But when I update to 1.5.1 I got this compile error meesage :
Library\PackageCache\com.unity.textmeshpro@1.5.1\Scripts\Editor\TMPro_FontAssetCreatorWindow.cs(11,19): error CS0234: The type or namespace name ‘TextCore’ does not exist in the namespace ‘UnityEditor’ (are you missing an assembly reference?)
I’m using unity 2018.4.2f1 , How can I fix that?
I using 1.4.1 version it work fine. but I can’t update to 1.5.1 version
By the way , I can use 1.5.0 with 2018.4.2f1 , It’s also have “Multi Atlas Texture”
The above error seems strange and might be related to some Library cache issue.
It might be related to the fact you are using an early version of 2018.4. I would suggest updating to one of the newer release of 2018.4 although it is strange 1.5.0 would be fine.
Let me know if the above helps?
How to change fonts through Asset Bundle when I am using Textmesh Pro.
In the project, I will changes fonts asset successfully but when i m try to set font through Asset Bundle at that time not set asset bundle font successfully