Search Unity

Does Line Breaks for Asian Languages in UIToolkit Work?

Discussion in 'UI Toolkit' started by Hinuko, Jul 1, 2022.

  1. Hinuko

    Hinuko

    Joined:
    May 13, 2017
    Posts:
    7
    Even if you register the Japanese period [。] as LeadingCharacters in Line Breaking for Asian languages in PanelTextSettings, it is displayed at the beginning of the line as the screen capture shows.

    upload_2022-7-1_9-7-1.png

    To reproduce this,
    1. Create a [1]PanelSettings Asset.
    2. Create a [2]PanelTextSettings Asset and set it as Text Settings for PanelSettings[1].
    3. Create a [3]text file and enter any characters you want. Set it as Line Breaking for Asian languages > LeadingCharacters in PanelTextSettings[2].
    4. Place a GameObject with [4-1]UIDocument Component in the scene, create a [4-2]VisualTreeAsset to be set as the Source Asset, and input the characters in the text file[3] to be displayed at random using TextElement. Set the PanelSettings[1] for it.
    5. If you change the size of the text or increase the number of characters, you will find that characters that should be specified in the text file[3] are sometimes displayed at the beginning of the text.

    I'm not sure if it is only me and I did something wrong or there is a bug. Any help or comment would be appreciated.

    Unity Version: 2022.1.4f1
     
  2. Hinuko

    Hinuko

    Joined:
    May 13, 2017
    Posts:
    7
    Interestingly, I installed TextMeshPro and Import TMP Essential Resources and it works. After some experimentation, it seems that the text files are loaded directly from Resources, so it is important to name them as follows.
    - Resources/LineBreaking Following Characters.txt
    - Resources/LineBreaking Leading Characters.txt
     
  3. Hinuko

    Hinuko

    Joined:
    May 13, 2017
    Posts:
    7