Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Generating static font assets from script

Discussion in 'UGUI & TextMesh Pro' started by matiasticbits, Aug 21, 2020.

  1. matiasticbits

    matiasticbits

    Joined:
    Jan 3, 2017
    Posts:
    30
    We have been using TextMesh Pro 1.3.0 for a long time but now we are looking into upgrading Unity to 2019.4 and this forces us to update TextMesh Pro to 2.0.1 or newer.

    We have been using multiple static generated fonts to support multiple languages and we are using our custom script to generate all fonts from the command line. Originally this was made by following how TMPro_FontAssetCreatorWindow handles this, but after the update to 1.4.0 multiple classes and fields became unaccessible from our code, as they were changed to be internal.

    We have tried optional approach using reflection with TMPro_FontAssetCreatorWindow to generate the fonts using/manipulating the editor window. But this fails as most of the font generation logic is actually inside DrawControls method and under GUILayout.Button block, so we cannot invoke it properly.

    It is hard to believe that the font generation doesn't have an API available. What would be the suggested way of handling font generation for static fonts? Manually update them whenever we have a need to update the fonts one at a time? Using dynamic fonts is not an option as the build size would grow significantly if we had to include all the fonts to our build that we require to cover all the languages we support. Does TextMesh Pro supports using device provided font file for dynamic fonts, similar how Unity's Text component supports variety of characters?
     
  2. urosprosenik

    urosprosenik

    Joined:
    Jan 31, 2021
    Posts:
    1