Since I have Japanese localization, I imported the NotoSansCJK-Regular into a build. Unfortunately I got struck bu an error from Github, as the font asset file is 140MB big. Which is massive. It bloated to these proportions although font’s original size is 16MB.
Any way to remedy the situation? Otherwise I cannot Push it to repository.
Since the Atlas size is 8192 x 8192, the texture alone is 64MB.
My recommendation is that instead of using a huge 8192 x 8192 Atlas texture, to create a static font asset that only contains the known characters / text used in the project. Most likely you should be able to fit all those characters in a 1024 x 1024 and potential be able to increase the sampling point size.
Then to handle all potential characters coming from user input or other sources (not known at build time), create a Dynamic font asset with Multi Atlas Texture enabled and assign it as fallback to your primary static font asset.
This atlas can also be 1024 x 1024. Make sure you use the same Sampling Point Size to Padding Ratio as the Primary static font asset to ensure the visual appearance of Outlines, Shadows, etc. are consistent between the Primary and fallback. Just to be clear the Ratio of sampling point size to padding has to be the same but not the sampling and padding. For instance, the Primary could use sampling point size of 90 with padding of 9 for a 10% ratio. The dynamic fallback could have a sampling point size of 60 with padding of 6 for the same ratio of 10%.
When Dynamic font assets are created or reset via the context menu, their atlas texture size is zero. Then when the first glyph is added, their atlas texture is resized to the defined size in the Generation Settings. As such and provided you reset them before creating your build, their contribution to build size is marginal.
Changes to Dynamic font assets in the Editor are persistent which is why you should reset them before a build unless you want to ship them partially filled. At runtime and at the start of each play session, they always revert back to their shipping state which is they were reset is back to empty / zero size.
Multi Atlas Texture makes it possible for the dynamic font asset to add new atlas textures as needed in the event the first atlas texture is full. This makes it possible for a dynamic font asset with multi atlas texture to potentially handle every single glyph contained in a font file.
Using the above recommendation will result in your primary static font asset taking slightly more than 1 MB. The dynamic font asset assigned as fallback to your primary static should take a few kilobytes provided you reset it before the build. Then since the dynamic font asset references the font file, it will be included in the build and thus contribute whatever its size is. So in your case, I would expect this revised setup to be about 16MB + 1MB + kilobytes. So less than 18MB vs. 140MB.
See the following videos which cover all of this and how to handle CJK.
This is my Fallback font from the getgo. Are you saying, that I can just resize the atlas to, say 1024x1024, make a padding somewhat 40/4 and I will be good to go?
Make sure you enable Multi Atlas Texture on the Fallback. Also be sure to Reset it before creating your build to make sure the Fallback is empty with its atlas texture back to size = 0.
P.S. In the next release of TMP, you will be able to set “Clear Dynamic Data on Build” per font asset. This will automatically Reset those font asset when you create a build. This way you don’t have to remember to do it manually.
What do you mean by importing the new one? Where is this new one created and how is it imported?
I would try to always use textures that are of the same width and height.
I would not recommend using atlas textures larger than 2048 x 2048. If using dynamic font assets, I would use 1024 x 1024 with multi atlas texture enabled.