REOPENED Bug 231668
CJK ligatures are totally broken because computePreferredLogicalWidths() is totally busted
https://bugs.webkit.org/show_bug.cgi?id=231668
Summary CJK ligatures are totally broken because computePreferredLogicalWidths() is t...
Toto
Reported 2021-10-13 05:17:11 PDT
Created attachment 441059 [details] An example in Safari, Firefox and Chrome Source code, in CSS: ```css .dlig { font-feature-settings: "dlig"; } ``` In <body>: ```html <p>中心気圧九四〇<span class="dlig">メリ</span>バール・瞬間最大風速五〇<span class="dlig">メートル</span>・暴風雨半径二五<span class="dlig">〇キロ</span>……</p> ``` <span> won't shrink for ligatures inside, which left extra spacing after.
Attachments
An example in Safari, Firefox and Chrome (373.89 KB, image/png)
2021-10-13 05:17 PDT, Toto
no flags
Test html file (346 bytes, text/html)
2021-10-25 18:37 PDT, Myles C. Maxfield
no flags
macOS Monterey (412.15 KB, image/png)
2021-10-25 18:38 PDT, Myles C. Maxfield
no flags
Repro (393 bytes, text/html)
2021-10-25 20:01 PDT, Myles C. Maxfield
no flags
Reduction (213 bytes, text/html)
2021-10-25 20:07 PDT, Myles C. Maxfield
no flags
Enable `dlig` in parent scope vs. in specific <span> (28.41 KB, image/png)
2021-10-25 22:08 PDT, Toto
no flags
Myles C. Maxfield
Comment 1 2021-10-13 07:25:29 PDT
Radar WebKit Bug Importer
Comment 2 2021-10-20 05:18:18 PDT
Myles C. Maxfield
Comment 3 2021-10-25 18:27:16 PDT
*** This bug has been marked as a duplicate of bug 6148 ***
Myles C. Maxfield
Comment 4 2021-10-25 18:34:18 PDT
Myles C. Maxfield
Comment 5 2021-10-25 18:37:28 PDT
Created attachment 442443 [details] Test html file
Myles C. Maxfield
Comment 6 2021-10-25 18:38:41 PDT
Created attachment 442444 [details] macOS Monterey I'm not seeing the bug on macOS Monterey using the attached .html file. Do you think you could tell me if the attached .html file shows the bug on your machine? If not, do you think you could provide a test file that shows the bug? Thanks!
Toto
Comment 7 2021-10-25 18:50:16 PDT
I also don't think the bug's the same as https://bugs.webkit.org/show_bug.cgi?id=6148, as I might not try to style anything. https://bug-231668-attachments.webkit.org/attachment.cgi?id=442443 is not using `dlig` feature because the default font is not supported. `font-family` should be set to 'Hiragino Mincho ProN', etc. to render the ligatures.
Myles C. Maxfield
Comment 8 2021-10-25 20:01:11 PDT
Myles C. Maxfield
Comment 9 2021-10-25 20:01:18 PDT
I can reproduce it now.
Myles C. Maxfield
Comment 10 2021-10-25 20:07:06 PDT
Created attachment 442458 [details] Reduction
Myles C. Maxfield
Comment 11 2021-10-25 20:09:04 PDT
We're not using LFC.
Myles C. Maxfield
Comment 12 2021-10-25 20:17:59 PDT
Wait a minute, we are using LFC.
Myles C. Maxfield
Comment 13 2021-10-25 20:19:21 PDT
Oh, no we're not. We're just using the iterators, which are in layout/integration. The iterators point to a LegacyInlineBox.
Myles C. Maxfield
Comment 14 2021-10-25 20:29:06 PDT
RenderText::width is using the result of computePreferredLogicalWidths() to determine the width.
Myles C. Maxfield
Comment 15 2021-10-25 20:29:45 PDT
m_maxWidth
Myles C. Maxfield
Comment 16 2021-10-25 20:36:08 PDT
Because the text is Japanese, there are line breaking opportunities around each character, so computePreferredLogicalWidths() is measuring each character individually - ignoring the fact that there is a ligatures that crosses 4 characters.
Toto
Comment 17 2021-10-25 22:08:30 PDT
Created attachment 442463 [details] Enable `dlig` in parent scope vs. in specific <span> <p><span class="dlig">株式会社</span>カブシキ</p> <!-- Error --> <p class="dlig">株式会社カブシキ</p> <!-- Worked, see attachment --> Enabling `dlig` in parent scope works just fine. But sometimes you just want certain characters to have the effect.
Myles C. Maxfield
Comment 18 2021-10-25 22:51:30 PDT
This should be fixed by IFC. We'll stop calling computePreferredLogicalWidths().
Note You need to log in before you can comment on or make changes to this bug.