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

[3.x] Fix RichTextLabel auto-wrapping on CJK texts #49280

Merged
merged 1 commit into from
Jun 9, 2021

Conversation

timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Jun 3, 2021

This PR fixes #21482.

There is still 1 px difference between when they wrap the last character after this fix. This is becauses Label autowraps if the text chunk width >= frame width, while RichTextLabel autowraps if text chunk width > frame width. I think this is not related to the original issue and worth a dedicated PR if desired.

Complex Text Layout on the master branch is the proper way to solve the wrapping problem, but it seems that it won't be backported.

This PR also supersedes #45290. I also added a fix to solve the issue mentioned in #45290 (comment), allowing word breaking on CJK and non-CJK edge. I'll revert this additional fix if it should be a separate PR.


Before: (there is unexpected linebreak after "Hopefully, ", and "should" wraps after "sh")
before

After:
after

@timothyqiu timothyqiu requested a review from a team as a code owner June 3, 2021 14:12
@Calinou Calinou added this to the 3.4 milestone Jun 3, 2021
@akien-mga akien-mga requested a review from bruvzg June 7, 2021 20:39
@timothyqiu
Copy link
Member Author

@bruvzg I used a slightly different range than you suggested.

  • Ends CJK Unified Ideographs at 9FFF instead of 9FCB, the latter is the end of assigned code points as of Unicode 5.2, but expanded to the end of the block in later versions.
  • Added F900 - FAFF, the CJK Compatibility Ideographs block
  • Added 30000 - 3134F, the CJK Unified Ideographs Extension G block
  • Added FF65 - FF9F and FFA0 - FFDC for halfwidth form of katakana and compatibility jamo

@akien-mga akien-mga merged commit 0d68db1 into godotengine:3.x Jun 9, 2021
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.3.3.

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

Successfully merging this pull request may close these issues.

4 participants