RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    UTF-8 support for word-wrap

    Scheduled Pinned Locked Moved Ideas and Development
    retropieemulationstatigamelist.xmlsuggestion
    5 Posts 3 Posters 647 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      waitingmoon
      last edited by

      Hello. I am currently working on a personal project to create a Japanese gamelist.xml that can be used in EmulationStation.

      The problem is that EmulationStation only recognizes spaces as delimiters/line breaks, which makes natural word-wrapping of long sentences impossible for certain languages that basically do not use delimiters (such as Japanese and Chinese). This means that writing game descriptions becomes very difficult.

      alt text

      The RetroPie community in Japan (including Recalbox, etc.) calls this problem the "word wrap problem" and deals with it by either giving up on the description or inserting a space for each character.

      To solve this problem, years or so ago, eagle0wl and zigurana edited Font.cpp on their forks.
      https://github.com/eagle0wl/EmulationStation/blob/master/es-core/src/resources/Font.cpp

      It seemed to work well in the screenshot he uploaded to his blog. Could I ask you to implement a feature similar to this?

      alt text

      1 Reply Last reply Reply Quote 2
      • mituM
        mitu Global Moderator
        last edited by mitu

        That could be an interesting challenge.

        FWIW, the example from their blog (the 2nd picture) is somehow wrong.
        While Japanese does not use spaces to separate the words in a sentence, there are some rules for line breaking in a multi-line text (Kinsoku Kinshori / 禁則処理). According to those rules, the 1st line in the picture should not start with a 「 (LEFT CORNER BRACKET). Am I wrong ?

        1 Reply Last reply Reply Quote 0
        • W
          waitingmoon
          last edited by

          Thank you for your interest in my project.

          Technically speaking, kinsoku shori is not a required implementation. While it is certainly important, it is just a rule to help you write "readable, understandable, and good-looking Japanese text".

          In some cases, you can turn off "Apply line breaking rules to auto line breaks" and intentionally place them at the beginning/end of a sentence.

          1 Reply Last reply Reply Quote 0
          • LolonoisL
            Lolonois
            last edited by

            If this CJK fonts and wordwrap gets picked up at a later stage, just some notes:

            Implications have been extensively discussed between Python developers, finally the change was dismissed, but a option to control the word wrap is planned for the textwrap module in v3.11 [2].

            [1] https://bugs.python.org/issue24665
            [2] https://bugs.python.org/issue12499

            1 Reply Last reply Reply Quote 2
            • mituM
              mitu Global Moderator
              last edited by

              @waitingmoon I've adapted the changes submitted by @Zigurana and eagle0wl and submitted a new PR, which was accepted recently.

              If you're using RetroPie, you can install the emulationstation-dev package (from the experimental packages section) and try it out.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

              Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.