Search Unity

ugui Text doesn't work well with Chinese/Japanese

Discussion in 'UGUI & TextMesh Pro' started by noanoa, Mar 6, 2020.

  1. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    Unity's Text component doesn't work well with non-latin languages like Chinese and Japanese where there are no space between words. (The default hyphenation and line-breaking only take half-size character(space, comma etc) into account).

    I've been waiting for years for Unity to implement proper hyphenation/line breaking support or at lease maybe you could expose/give us some functions so we can customize the hyphenation rules?

    Please support these languages!
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    TextMesh Pro has support for line breaking for CJK text which is partially controlled by the Line Breaking Leading & Following character list defined in the TMP Settings. In the TMP Settings you can also defined if the Modern Line Breaking rules (use of spaces) will be used for Hangul / Korean text.

    TMP also provides additional support for non-breaking space <nbsp> and other layout control characters.

    The next release will include additional improvements to add soft line breaks which can be used to further control text layout.

    New tags such as <nbsp> <zwsp> and <nobr> </nobr> have been introduced to also provide added functionality.

    Lastly, dynamic SDF support has been available since version 1.4.0.

    Support for Multi Atlas Texture was added in the first preview releases of 1.5.0 for Unity 2018.4, 2.1.0 for Unity 2019.x and 3.0.0 for Unity 2020.x.

    I would recommend switching over to using TMP which has been included by default in Unity since 2018.4. The latest releases are available via the Package Manager. Preview 6 will be released over the weekend.

    Below is an example of the improved line breaking control using some of these control characters.

    "<nobr>デザイン</nobr><zwsp><nobr>した</nobr><zwsp><nobr>のは、</nobr><zwsp><nobr>持ち運べる</nobr> <nobr>Google。</nobr>"

    https://imgur.com/kXASReq
     
    Last edited: Mar 6, 2020