Skip to content

Add correct line breaks support for non-latin languages #3328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

seagullua
Copy link
Contributor

Without this patch, the Cyrillic and other non-latin languages had an issue with line breaks in LabelTTF. The world was broken in any place.

Before in LabelTTF the string "Привіт як в тебе справи" will be shown next way:

Привіт як в те
бе справи

The word тебе was cut into pieces
After the patch it works ok:

Привіт як в 
тебе справи

@pandamicro
Copy link
Contributor

pandamicro commented Jul 18, 2016

Hi, this fix will break the current behavior with some Oriental languages (Chinese / Japanese), because all characters in these Oriental languages are aligned together, no space to separate them, the line break can be added anywhere in between. ex:

中文语句中是不包含空格的

If the Label width is short, this should be convert to

中文语句中是
不包含空格的

But with this PR, it can't break lines correctly.

The problem with the current engine implementation is that it haven't included many non-latin languages into the line break algorithm, you can overwrite the regular expressions manually in your game like you do here, but I'm sorry that we can't do it this way in the engine.

@ntrrgc
Copy link
Contributor

ntrrgc commented Jan 31, 2017

Here is my attempt. #3450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants