Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Is it possible to provide some hints to the in-game typesetting system?  (Read 2112 times)

jn_xyp

  • Ensign
  • *
  • Posts: 28
  • Ordinary Player, Fossic.org customer support
    • View Profile
    • Jn_xyp's Blog (In Chinese)

Hi everyone!

I am currently working on a mod translation project, to translate the text in an existing mod from English to Chinese.

You may know that in Chinese language, people do not insert spaces between words and after commas and periods, so when the in-game layout engine tries to render the text to the text field, it will identify the whole paragraph in Chinese as a single word. Which means if the length of the paragraph exceeds the length of one line on the screen (this always happen), the extra characters will not be displayed at the second and other lines below, and the player will not be able to see it because they are actually be rendered out of the text area. :P

Insert spaces between each Chinese characters work as a valid but terrible solution because the spaces between characters make paragraph hard to read and also unsightly. :-[

We also tried to insert an ASCII control character "FF" (Form Feed), which will not be displayed but help the system to recognize Chinese paragraph as separated words. However, these control characters cause unexpected random game crashes while playing.  :-\

So my question is, is there any measure we can use to give some hints to the typesetting system, in order to help it recognize Chinese word separation and display them correctly.

Thank you very much!
« Last Edit: March 06, 2018, 08:47:27 PM by jn_xyp »
Logged
Ordinary Player, maintainer and customer support of fossic.org.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile

Hi! Hmm. I think if you change the "space" character (20, iirc) in the .fnt file to have a width and xadvance of 0, and then insert a space after every character, that should work - the game will see each character as a separate word, but the spaces will have zero width and will be effectively invisible. If you then need to use whitespace for something, you could probably repurpose the tab character, or something else.
Logged

jn_xyp

  • Ensign
  • *
  • Posts: 28
  • Ordinary Player, Fossic.org customer support
    • View Profile
    • Jn_xyp's Blog (In Chinese)

Hi! Hmm. I think if you change the "space" character (20, iirc) in the .fnt file to have a width and xadvance of 0, and then insert a space after every character, that should work - the game will see each character as a separate word, but the spaces will have zero width and will be effectively invisible. If you then need to use whitespace for something, you could probably repurpose the tab character, or something else.

Thanks for your reply!

This is an effective solution to this problem, I will try on my game.
However, in fact, I am not the people who responsible for the Chinese translation fonts :). And if we decide to add spaces in translations, we need to ask all mod translators and Chinese mod authors to change their texts, which will be a pretty big project...

Thank you again for your suggestion!
Logged
Ordinary Player, maintainer and customer support of fossic.org.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile

Looking at it again, the way it wraps a word if it exceeds the line width is a bug. Fixed it for the next release - that is, it'll just add line breaks as needed when a single word is too long for a line, instead of going crazy and adding a ton of extra line breaks.

Not much help right now, of course, but at least it should work properly from the next release on.
Logged