How to make TPT have other languages

  • dimo
    16th Jul 2019 Member 0 Permalink


    I tried to open the source code of tpt with vs, modify the parameters behind the Description, and modify the language to other languages, but after compiling and running, the displayed text is a small square, garbled. I have tried a variety of methods and can't succeed. Is there any way to change the language into other languages such as Japanese, Chinese, etc?

  • LBPHacker
    16th Jul 2019 Developer 0 Permalink

    Short answer: Edit data/font.* with the font editor (scons --font).

     

    Long answer: Don't try that (at least not alone), read on to know why.

     

    There have been a few attempts at making the game work with CJK characters and some were fairly successful, but the improvements they made never got into the official game.

     

    The code supports UTF-8 perfectly at the string level, but the renderer doesn't support any sort of advanced Unicode (combining characters, variations depending on position in word, etc.). That aside, as far as I can tell, CJK doesn't need too much of that (i.e. text can probably be naively plotted character-by-character and still look acceptable), and in fact if the font (data/font.*) contained CJK characters, the game would happily render them that way.

     

    The problem is that the font is hard-coded to be 12 pixels tall and that includes the space between lines of text, and I think CJK characters would be difficult to read at a resolution of 10-11 pixels. It's also possible that I'm completely in the wrong; this thread on SO suggests that with an 1-bit font the lowest acceptable resolution would be 8x8 and 12x12 would be fairly good; and hey, TPT's font is 2-bit, so maybe 10x10 could work well.

     

    I'm a bit skeptical about this because I speak two of the languages that use CJK and know just how important the details of characters are, but it wouldn't be the first time the character recognition ability of humans surprised me and I've never tried making a CJK font before. I'd happily work together with anyone who has experience in creating small CJK fonts to add CJK support to TPT.

     

    Of course it's also possible to just increase the font height, but that would be a lot of pain.

    Edited 3 times by LBPHacker. Last: 16th Jul 2019
  • LBPHacker
    31st Jul 2019 Developer 0 Permalink

    Bump?