RESOLVED FIXED 205485
[WinCairo] Some of combining family glyphs are replaced by space glyphs
https://bugs.webkit.org/show_bug.cgi?id=205485
Summary [WinCairo] Some of combining family glyphs are replaced by space glyphs
Fujii Hironori
Reported 2019-12-19 20:26:52 PST
[Win] fast/text/stale-TextLayout-from-first-line.html is failing since Bug 204884
Attachments
simplified test case (124 bytes, text/html)
2019-12-19 20:33 PST, Fujii Hironori
no flags
WIP patch (3.39 KB, patch)
2019-12-22 22:19 PST, Fujii Hironori
no flags
[Screenshot] WinCairo port (135.20 KB, image/png)
2020-01-09 20:46 PST, Fujii Hironori
no flags
Patch (9.25 KB, patch)
2020-01-16 03:58 PST, Fujii Hironori
no flags
Patch (11.93 KB, patch)
2020-01-16 16:59 PST, Fujii Hironori
no flags
Patch for landing (12.01 KB, patch)
2020-01-22 22:16 PST, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2019-12-19 20:33:05 PST
Created attachment 386177 [details] simplified test case ̀ doesn't show because ComplexTextController::adjustGlyphsAndAdvances replaces a glyph of &#x0300 with the space glyph. stringIndices given by collectComplexTextRunsForCharacters are incorrect. Uniscribe returns clusters. For " ̀", it returns [0 0]. This means both glyphs consist of a single cluster starting at 0th glyph. Then, clusters are converted into stringIndices. It's [0 0]. This means both glyphs correspond to 0th charcther. This is incorrect. ComplexTextController::adjustGlyphsAndAdvances replaces glyphs in the positions of space charcthers with the space glyph.
Fujii Hironori
Comment 2 2019-12-20 01:09:29 PST
fast/text/emoji-single-parent-family.html has a similar issue. 👨‍👦 shows only the father glyph because ComplexTextController replaces the boy glyph with a space glyph. ScriptShape input text: [👨 ‍ 👦] (length=5) output glyphs: [6368 6318] which are fater and boy glyphs output clusters: [0 0 1 1 1] which means consisting two clusters, and the 0th cluster starts at glyphs[0] (father glyph), 1st cluster starts at glyphs[1] (boy glyph) Then, stringIndices: [0 2] which means glyphs[0] points to text[0], glyphs[1] points to text[2] (zwj). ComplexTextController replaces the boy glyph with a space glyph because glyphs[0] (child glyph) points to zwj..
Fujii Hironori
Comment 3 2019-12-22 22:19:39 PST
Created attachment 386326 [details] WIP patch
Fujii Hironori
Comment 4 2020-01-09 20:46:09 PST
Created attachment 387312 [details] [Screenshot] WinCairo port It breaks happily combining family glyphs. https://emojiterra.com/family/
Fujii Hironori
Comment 5 2020-01-14 02:54:24 PST
*** Bug 206058 has been marked as a duplicate of this bug. ***
Fujii Hironori
Comment 6 2020-01-15 02:57:12 PST
This patch solves the missing glyph problem of fast/text/stale-TextLayout-from-first-line.html, but it doesn't pass the test yet due to another bug. I change the summary of bug, and file another bug for fast/text/stale-TextLayout-from-first-line.html.
Fujii Hironori
Comment 7 2020-01-16 03:58:59 PST
Fujii Hironori
Comment 8 2020-01-16 16:59:56 PST
Myles C. Maxfield
Comment 9 2020-01-22 09:21:53 PST
Comment on attachment 387990 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387990&action=review > Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:146 > + int endGlyphIndex = !finish ? clusters[endStringIndex] : -1; Nowadays we prefer to use out-of-band sentinels. How about Optional<unsigned>?
zalan
Comment 10 2020-01-22 09:22:47 PST
(In reply to Myles C. Maxfield from comment #9) > Comment on attachment 387990 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=387990&action=review > > > Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:146 > > + int endGlyphIndex = !finish ? clusters[endStringIndex] : -1; > > Nowadays we prefer to use out-of-band sentinels. How about > Optional<unsigned>? or Optional<size_t>
Fujii Hironori
Comment 11 2020-01-22 21:23:22 PST
Comment on attachment 387990 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387990&action=review Thank you very much for the review. >>> Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:146 >>> + int endGlyphIndex = !finish ? clusters[endStringIndex] : -1; >> >> Nowadays we prefer to use out-of-band sentinels. How about Optional<unsigned>? > > or Optional<size_t> Yes, this part is bad. It should use stringIndicesRange.end() as the sentinel if finish is true. If the real index is used, by allowing to get the real index of end(), the code would look like: > int endGlyphIndex = !finish ? clusters[endStringIndex] : stringIndicesRange.end().index(); If the iterator is used, by add a method to get a iterator from real index, the code would look like: > auto endGlyphIndex = !finish ? stringIndicesRange.fromIndex(clusters[endStringIndex]) : stringIndicesRange.end(); I will take later way.
Fujii Hironori
Comment 12 2020-01-22 22:16:48 PST
Created attachment 388519 [details] Patch for landing
Fujii Hironori
Comment 13 2020-01-22 22:20:55 PST
Comment on attachment 388519 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=388519&action=review > Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:162 > + for (; glyphIndex != endGlyphIterator; ++glyphIndex) This loop condition was greatly improved. Less condition, no conversion from a iterator to a real index. before: > for (; glyphIndex != stringIndicesRange.end() && glyphIndex.index() != endGlyphIndex; ++glyphIndex) after: > for (; glyphIndex != endGlyphIterator; ++glyphIndex) Thank you very much.
Fujii Hironori
Comment 14 2020-01-22 22:47:50 PST
Comment on attachment 388519 [details] Patch for landing Clearing flags on attachment: 388519 Committed r254965: <https://trac.webkit.org/changeset/254965>
Fujii Hironori
Comment 15 2020-01-22 22:47:53 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 16 2020-01-22 22:48:17 PST
Note You need to log in before you can comment on or make changes to this bug.