Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

UI Text to use system installed fonts

Discussion in 'UGUI & TextMesh Pro' started by swang_hothead, May 7, 2021.

  1. swang_hothead

    swang_hothead

    Joined:
    Jul 15, 2019
    Posts:
    6
    Hi,

    I am trying to use system installed fonts to display some specific texts in our games, only solution right now is to use uGUI text. If the font has "Inc. Font Data" untoggled, then it will fallback to use system font listed in a hard coded secret list.

    There are 3 things I want to ask for a solution:
    1. Can we achieve the same behavior without a placeholder ttf, instead, just have that font generated at runtime?
    2. If we use textmesh pro, how to make textmesh pro being able to use that placeholder font(directly use that font to create a dynamic font asset won't work)?
    3. With textmesh pro, there is a way to grab system font paths and use Font constructor to achieve similar pattern, it's somehow working, however, for example, on iOS, all CJK characters are rendered with PingFang.ttc, you can get the path of it and create a font asset, but you have no way to specify which ttf within that ttc should be used, we need a way to tell FontEngine to use PingFang_SC.ttf only.

    Any suggestion or answers?

    Thanks!
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    In the next set of preview releases of the TMP package, I will be introducing a new font asset type which is Dynamic OS.

    In the Editor, these will work like Dynamic font assets where you will need to specify the source font file which will be used when trying to add new characters and glyphs to it.

    When creating a build and unlike Dynamic font assets, the source font file will NOT be included where at runtime it will look for this font file by family and style name. Provided this font file is present on the system / platform, it will us it. If the font file is not found, it will then us whatever fallback you have specified in the local or global fallback lists.

    In addition to Dynamic OS font assets, I will also be adding support for selecting the font face in a TrueType Collection (TTC) font as seen below.

    upload_2021-5-11_15-49-30.png

    When creating a Dynamic OS font asset, you will specify the source font file in the Editor as well as select the font face assuming this font file is a .ttc file.
     
  3. swang_hothead

    swang_hothead

    Joined:
    Jul 15, 2019
    Posts:
    6
    Hi, thanks for replying. Great feature! Do you have a timeline for when this will be releasing?
     
    Last edited: May 12, 2021
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Hoping to have the first preview release available within the next 30 days or so.