Skip to content
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

CJK glyph flow in UI labels should not line break on whitespace #40688

Closed
HybridEidolon opened this issue Jul 25, 2020 · 1 comment · Fixed by #41100
Closed

CJK glyph flow in UI labels should not line break on whitespace #40688

HybridEidolon opened this issue Jul 25, 2020 · 1 comment · Fixed by #41100
Milestone

Comments

@HybridEidolon
Copy link
Contributor

Godot version:
3.2.2 Stable

OS/device including version:
Windows 10 64-bit

Issue description:
When rendering east-Asian language text inside a label, the node is treating whitespace codepoints as a line break point, even though it may be inappropriate. The result is essentially showing one sentence per line, if spaces are used to separate sentences. A semi-correct behavior can be attained by not placing whitespace between sentences.

image

(The text featured is translated with Google Translate; I apologize if it doesn't make any sense to Japanese readers)

Wikipedia has an article on line-breaking for East-Asian Languages. I believe this is a fairly important feature for supporting these locales as this also impacts presentation of labels in the Godot Editor, which would result in a subpar editor experience.

Steps to reproduce:

  1. Create a Label node
  2. Set its text to a combination of English and Japanese sentences.

Minimal reproduction project:
CJKWordWrapIssue.zip

This zip contains NotoSans-Regular.otf and NotoSansJP-Regular.ttf, both of which are used and distributed under the terms of the SIL Open Font License.

@bruvzg
Copy link
Member

bruvzg commented Jul 25, 2020

As far as I know, breaking after arbitrary CJK glyph is not correct either, reliable detection of words in CJK, Thai and any other languages when using hyphenation will require use of dictionary. Also, many languages use alternative space marks.

See UAX #29, Unicode Text Segmentation and UAX #14, Unicode Line Breaking Algorithm for more information.

As soon as complex text layouts are implemented, correct line / word breaking will be handled by use of ICU BreakIterator.

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

Successfully merging a pull request may close this issue.

4 participants