apache / apache/echarts

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

Open
#18,583 3 comments 0 reactions 0 assignees View on GitHub
bug difficulty: easy en
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.0.0 - 5.4.2
5.4.3-dev.20230502
5.5.0-dev.20230501

### Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=line-marker&code=PYBwLglsB2AEC8sDeAoWtJgDYFMBcya6GOAHmAQOQAqOAtiDgE4CGYArkzrAMIAWLaAHNuEOGD7cewOmKGwA6jhwBrADSxBAE02wsMeWDJgMkriwBmRphmCwLwJgGNuAd1YgQc27AGeccK4QEpqAPBuAhjsRUZEx0ZRqROhG5ADKYACeuASoxMTAAG7MFvquVABG5irxicRBWhIEACwADABMNQC-RB0JHQDcQA

### Steps to Reproduce

1. Create a chart with any text and set it up to wrap set text when overflowing.
2. Use characters of the so-called non-BMP.
3. Try some widths until you break within the character or before a space (or both as in the minimal reproduction)

### Current Behavior

![image](https://user-images.githubusercontent.com/24505746/235624311-a81becd3-7845-4a3e-800d-457307fedc8d.png)
The 3rd line starts with a space.
The 3rd line doesn't calculate the character widths correctly and is short.
One of the Domino Tiles has been broken into two illegal characters.

### Expected Behavior

According to the Unicode Standard (https://www.unicode.org/reports/tr14/#SP) the wrapping should occur after all space-characters when a line-break is desired by the algorithm. Characters should also, obviously, not be broken in two and their width should be correctly determined.

### Environment

```markdown
- OS: Windows 10
- Browser: Edge 112.0.1722.58 (Chromium)
```

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.