Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

TextMesh Pro CJK font rendering errors (bitmap fonts)

Discussion in 'Unity UI & TextMesh Pro' started by rempelj, Oct 18, 2018.

  1. rempelj

    rempelj

    Joined:
    Aug 3, 2013
    Posts:
    47
    Hi,

    I am trying to render Noto CJK as a hinted raster bitmap font so that I can get small, crisp CJK characters in my game which has a low native resolution.

    This works for Latin characters. However, with CJK, there are some issues:

    1. The character baselines are inconsistent
    2. The character sizes are inconsistent

    Figure A and B are rendered in-game. Notice the baseline for the characters jump around in figure A. In figure B, I have adjusted the baseline by hand as an example of how the characters should be positioned.



    Figure C is rendered in a word processor. This is how the character alignment/sizes should look. Notice how the size of some characters differs from the in-game text.



    Do you have any ideas what I could be doing wrong here?

    Thanks

    Justin
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,469
    Some CJK characters use the OpenType Base table which isn't currently supported.

    Until this is supported (no ETA), the only solution is to manually adjust both baseline and potential scale of those glyphs in the Font Asset inspector.
     
  3. rempelj

    rempelj

    Joined:
    Aug 3, 2013
    Posts:
    47
    Thanks @Stephan_B

    Does that mean I should avoid OTF fonts? Would a TTF font work?
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,469
    Most likely OTF fonts will make use of the Base table but that can also be the case for TTF fonts as well as many TTF fonts are OpenType but with the .TTF extension.

    Since few glyphs are likely to be using the Base table / require manual adjustment, you may as well pick the font file that works best for you and do the manual tweaks.
     
  5. rempelj

    rempelj

    Joined:
    Aug 3, 2013
    Posts:
    47
    Manually adjusting the glyphs would not be feasible. There are just too many languages and font assets, each with more than a few glyphs needing adjustment. Also, it would be prone to error because I would be more-or-less eyeballing it - and I'm not versed in these languages.

    Is the OpenType Base table supported by SDF? My SDF fonts don't seem to have this issue.
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    2,469
    This is highly dependent on the font file itself. So some fonts might have the issue while others not. Also, hinting might be a factor here which is also dependent on the font file.