| Summary: | letter-spacing is totally broken in Burmese and Thai and Lao | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Myles C. Maxfield <mmaxfield> | ||||||
| Component: | Text | Assignee: | Nobody <webkit-unassigned> | ||||||
| Status: | NEW --- | ||||||||
| Severity: | Normal | CC: | mmaxfield, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Bug Depends on: | 236489 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
Created attachment 451626 [details]
Test case
Oh, wow, ComplexTextController applies letter-spacing to _every glyph_. That's totally bogus. It looks like the correct iterator to use is kCFStringCursorMovementCluster. This is turning out to be harder than I thought it would be. Because Burmese text is so complicated, it looks like I can't: - add space to the right side of a glyph if the character just after the character the glyph corresponds to is a boundary, because of the string "ဂြို". This string has 4 code points, but no glyph corresponds to the last code point - the last glyph corresponds to the second-to-last and last code points together. - add space to the left side of a glyph if the character the glyph corresponds to is a boundary, because of the same string "ဂြို". Here, the leftmost character corresponds to string index 1 and then the next glyph corresponds to string index 0. Therefore, if we did this, we'd inject letter-spacing in the middle of the cluster. I think the solution is to keep track of cluster boundaries as we iterate across glyphs, and insert space to the right of a glyph if the current glyph and the next glyph belong to different clusters. https://twitter.com/OhBendy/status/1492033041988001837 indicates that this is a problem for Thai and Lao too. |
Created attachment 451625 [details] Test case WebKit destroys the shapes of the letters. Compare to Chrome / Firefox.