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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Chinese font not being created correctly.

Discussion in 'UGUI & TextMesh Pro' started by mayflowerent, Mar 3, 2020.

  1. mayflowerent

    mayflowerent

    Joined:
    May 17, 2017
    Posts:
    2
    Hello all,

    I am having some issue with using Font TM Pro to create Chinese font to display.
    The font I am having issue is "PeacePosterBoldFigure".
    The font states that it supports traditional Chinese characters
    and when I install the font file to Windows, the font is working fine.
    However, many characters are missing when I create a TM Pro font object.

    For example, I am trying to display the text string.
    The font looks great with the font installed and applied in an Excel file.
    The same TM Pro object created using the Chinese character is missing a character.

    Font/text in Excel: [font_excel.png]
    The full character list file: [Txt_TMProFontCharacterFile_zh_full.txt]
    Font Creator settings: [font_tmpro.png]
    Font used: [Fnt_Sub_3.ttf](in zip file)

    Why is this happening?
    How can I ensure that all, most anyways, the characters in the list to be included in the TM Pro object?

    Below are the basic information of the work environment I am using.

    Windows 10 Home 1909
    Unity 2018.3.10f1
     

    Attached Files:

  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Looking at the font file with a font editing tool like High-Logic Font Creator, you can see lots of missing glyphs as per the image below.

    upload_2020-3-2_23-43-46.png

    In short all the missing characters the Font Asset Creator is reporting as missing are in fact missing from the font file. Of the 8251 characters in your source text file, 5397 are present in the font file and 2854 are missing as seen in the report below.

    upload_2020-3-2_23-45-51.png

    Many tools like Excel will use some other font for the missing glyphs which is someting you can accomplish in TMP by using a fallback font asset / font file that contains those missing glyphs.

    The source text file that you provided seems to include all 8105 Chinese characters from the Table of General Standard Chinese Characters + ASCII set.

    Given your source font file is pretty small in size, I would suggest creating a static font asset that only contains the known characters used in your project. Those are all characters contained in menus, dialogues, text, etc. but exclude everything else that will potentially come from user input. For those create a dynamic font asset using the same font file and assign it as fallback to the primary static font asset.

    The above will still leave you with some potential characters (those missing ones not covered) but those missing from the font file could be the 1605 + other less common characters.

    If you really need everything to be potentially covered (ie characters not contained in the font file) you could always create another dynamic font asset from another font like NotoSans CJK and assign it as fallback as well. The only issue with those other font files, is their size. But then again, if the missing glyphs are the very uncommon, you might be fine without them.
     
  3. mayflowerent

    mayflowerent

    Joined:
    May 17, 2017
    Posts:
    2
    Thank you for your insight Stephan_B.

    Yes, I had the same issue creating the font asset. I originally hoped that the missing glyphs would not affect text being used in my game, but it was not what I was expecting I guess.

    I am trying to match the font style so I was hoping to use this font "PeacePosterBoldFigure" if all possible. I am already using NotoSans CJK for a different set of text strings; I am using 3 fonts in total.

    You are exactly right on the characters list. I also thought of copying/pasting the entire text for font asset creation list to reduce the size of the font asset, but wanted to add as many characters as possible because there still is a chance that I might update the text; did not want to update the font asset everytime I make a change to the text.

    Overall, how would I be able to know which fallback font programs like Excel is loading from? Looking at the Excel example the font style matches perfectly so I would like to use whatever they are using as my fallback font if possible. Any font modifying program that I can use to find this out?
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    I am not exactly sure how Excel ends up picking alternative / fallback fonts. You could try something similar in Microsoft Word which I believe would be using the same logic for font / fallback selection where in this case, you should be able to select a character known to be missing and then be able to see what font ended up being selected.

    The are many font editing tools. FontForge is free and available for both Mac and Windows. Personally I like HighLogic FontCreator.

    P.S. Sorry about the delay in getting back to you. Things can get pretty crazy on my end where I can't follow up on posts nearly as quickly as I would like or even worst posts get lost in the shuffle.

    As I have said many times, please always feel free to bump your posts which helps bring these back to my attention or even sometimes (which I love) get the attention / reply from another TMP users :)
     
    Last edited: Mar 6, 2020