Jump to content

Automatic line breaks


Recommended Posts

Hello again!

My question this time isn't a huge deal, I was just wondering if a tool like this exists. Since there are no spaces in Japanese, there is no need to implement a function into a VN to make sure that words aren't ripped apart when reaching the end of a line. Western languages are different though, and almost all western text programs automatically shift the entire word to the next line if the word is too long for that line.

Can you add a function like that to a Japanese VN too? In case it matters, I'm translating "Saimin Class Wonderful" , which uses the EAGLS engine.

If you can't do that, I'd have to space the lines manually, which works, of course, but would require more time and would still rip words apart depending on how long the player's name is, so it's not the best solution.

Thanks for reading!

iambobokay

Link to comment
Share on other sites

I don't think there is a general solution. Everything I have seen so far have been made to work for just one VN each time. Having to match the length of something of variable length, such as a user defined name is problematic and I can't think of anything you can do other than teaching the engine to handle newlines in a sane manner, which is a highly advanced hacking task to do to a VN exe file when you don't have the source code.

Link to comment
Share on other sites

I wrote a custom function to do line breaks in the reinsertion code for To Heart 2. It was aware of the on-screen line length and had some basic rules regarding spaces, periods, commas, quotation marks, and hyphens. Since the player got to insert their own name at the start of the game the best I could do there was to use the default name space and accept it would break for longer names. I also merged all previous lines instead of keeping all the original line breaks; English is far more verbose than Japanese and needs more screen real estate so it couldn't afford the extra line breaks.

Link to comment
Share on other sites

3 hours ago, ittaku said:

I wrote a custom function to do line breaks in the reinsertion code for To Heart 2. It was aware of the on-screen line length and had some basic rules regarding spaces, periods, commas, quotation marks, and hyphens.

I wrote something like that for Musumaker as well. The problem with such an approach is kerning, as in some characters are shorter when followed by certain other characters. In order to add spaces correctly for this, you will likely need to use some sort of library to read the font and then get the width of the sentence that way. It's doable, but it requires more than just counting characters.

As for the name issue. One thing you should investigate is if you can add a newline. Some engines support it even if the Japanese script doesn't use it at all, sometimes as a newline and sometimes as \n. If the engine supports this, you can reserve a certain length, like what you estimate from say 16 characters and then end with a newline. This will result in the line being too short in most cases, but it will not cut words. It's not a good solution, but you can easily end up with not being able to get a good solution and only go for the least bad solution, in which case it could be an option.

Link to comment
Share on other sites

4 hours ago, ittaku said:

I wrote a custom function to do line breaks in the reinsertion code for To Heart 2. It was aware of the on-screen line length and had some basic rules regarding spaces, periods, commas, quotation marks, and hyphens. Since the player got to insert their own name at the start of the game the best I could do there was to use the default name space and accept it would break for longer names. I also merged all previous lines instead of keeping all the original line breaks; English is far more verbose than Japanese and needs more screen real estate so it couldn't afford the extra line breaks.

That sounds like more than enough for me. Could you go into more detail? Like, do I just add a text file with the function to the .pak file? And did you write it in a specific programming language? Since I am still rather new to this, it'd really help me if you could maybe show me the function you wrote (If you still have it.)

Link to comment
Share on other sites

18 hours ago, iambobokay said:

That sounds like more than enough for me. Could you go into more detail? Like, do I just add a text file with the function to the .pak file? And did you write it in a specific programming language? Since I am still rather new to this, it'd really help me if you could maybe show me the function you wrote (If you still have it.)

The reinsertion code for To Heart 2 was very specific for the game engine itself and was written in python. Unless you're a programmer yourself there's not much point in describing how I did it, and if you are a programmer then no doubt you can work it out for yourself anyway. My code is unique for the one game engine so it won't be of any use to you. You need a dedicated programmer to do the same thing for you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...