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 Update Font asset

Discussion in 'UGUI & TextMesh Pro' started by Majk-, Aug 11, 2017.

  1. Majk-

    Majk-

    Joined:
    Jan 29, 2017
    Posts:
    21
    I have a custom font, that I made some adjustments to, (changed 2 letters using FontForge) and now I want to import it to Unity.
    Since TextMesh Pro is not actually using the font. I have to create a Font asset, but that way I would lose all my font material presets.

    Q: Is there a way to update the Font asset, or do I have to regenerate everything from scratch?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You can actually create a new font asset and save it over the previous one. The Font Asset Creator will actually look through materials to find those that were using the previous font atlas and update them to use the new one.

    In order to ensure previous Material Presets look the same with the new font asset, you have to make sure to keep the same Ratio of Sampling Point Size to Padding as this determines the effective range of material properties and how they appear visually. So take a look at the previous font asset to see what the sampling point size was and padding value and re-use the same ones if possible. If not, again the ratio has to be the same but not the values. So if the old one was using 100 point size and 10 padding, the new one could be 80 with padding of 8.

    Since there is no API function in Unity to allow finding all materials that use a specific texture, TMP would have to load and look at all materials in the project to find those that were referencing the old font atlas texture to update those. Since that would be inefficient, TMP searches for Materials that contain the name of the font file. So make sure that your Material Presets are all prefix with the font name (which TMP does when you create them using the context menu - create material preset) this way, TMP will be able to update them when you regenerate a font asset as well as having them show up in the Material Preset pulldown in the inspector.
     
    hellowill89 likes this.
  3. Majk-

    Majk-

    Joined:
    Jan 29, 2017
    Posts:
    21
    That is amazing @Stephan_B . Thanks for the info.
     
  4. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
    @Stephan_B I don't understand the workflow for updating an existing TMP font asset. Am I expected to remember the settings I used to create the font asset previously?
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    When re-generating a font asset, you don't have to remember the previous settings as you can look up the information by inspecting the font asset you want to update.

    Having said that, I agree the process isn't optimum which is why in the next release of TMP, Font Asset Creation Settings will be saved in the Editor. I also added a new Context Menu option and button in the Font Asset Inspector to make the process of updating font assets much easier.

    Here is a sneak peak

    upload_2018-5-25_2-13-33.png
     
  6. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    128
  7. kimcatq

    kimcatq

    Joined:
    Jun 11, 2019
    Posts:
    9
    Updating the font was one of my major worries especially when the localisation text changes. This is one of my favorite update!!! I only found out about this feature right now. I have been holding off updating the font asset for 1 yr. Thanks @Stephan_B