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

Made the wrapping algorithm more closely align with Unicode Standard #1006

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Wetterquarz
Copy link

@Wetterquarz Wetterquarz commented Apr 12, 2023

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Spaces are now treated according to Unicode Standard (https://www.unicode.org/reports/tr14/#SP).
It now correctly reads in all characters as a single character.

Fixed issues

Fixes apache/echarts#18583

Details

Before: What was the problem?

It is possible for a wrapped line to start with a space, which may not happen if the line break was not intentional. And breaks to happen within characters.

image
image

After: How does it behave after the fixing?

Line breaks are now only inserted after the last space and trailing spaces are ignored for line breaking, as required by the Unicode standard. Characters which consist of two chars in JavaScript are now treated as one.

image

Documentation Info

One of the following should be checked.

  • This PR doesn't relate to documentation changes
  • The documentation should be updated later
  • The documentation changes have been made in ecomfe/zrender-doc#xxx

Misc

Related test cases or examples to use the new APIs

/test/text-overflow.html

Others

Merging options

  • Please squash the commits into a single one when merging.

@Wetterquarz Wetterquarz marked this pull request as draft April 13, 2023 12:46
@Wetterquarz Wetterquarz changed the title Made non-BMP characters be treated as a single character for wrapping. Made the wrapping algorithm more closely align with Unicode Standard Apr 13, 2023
Wrapping now happens after spaces instead of before and only after the last space in a sequence of spaces.
Characters which should not have a line break in front of them have been removed form the list, which become redundant as a consequence.
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.

[Bug] Zrender Overflow Word Wrapping can Break Apart Characters and can Break Before Spaces
1 participant