Changeset 272379 in webkit


Ignore:
Timestamp:
Feb 4, 2021 1:28:25 PM (3 years ago)
Author:
mmaxfield@apple.com
Message:

Supplementary code points (U+10000 - U+10FFFF) are not shaped correctly in the fast text codepath
https://bugs.webkit.org/show_bug.cgi?id=221356
<rdar://problem/72555297>

Reviewed by Zalan Bujtas.

Source/WebCore:

Supplementary code points are represented in UTF-16 as two adjacent (surrogate) code units. When we map code
points to glyphs, we were originally mapping these two code units to a single glyph. However, shaping
routines require that the number of code units and glyphs be equal, by injecting a 0 glyph for the trailing
surrogate.

Luckily, we don't actually have to delete these extra 0 glyphs, because the shaping engine will do that for us.

Test: fast/text/multi-code-unit-simple-path.html

  • platform/graphics/WidthIterator.cpp:

(WebCore::WidthIterator::advanceInternal):

LayoutTests:

  • fast/text/multi-code-unit-simple-path-expected-mismatch.html: Added.
  • fast/text/multi-code-unit-simple-path.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r272375 r272379  
     12021-02-04  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Supplementary code points (U+10000 - U+10FFFF) are not shaped correctly in the fast text codepath
     4        https://bugs.webkit.org/show_bug.cgi?id=221356
     5        <rdar://problem/72555297>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * fast/text/multi-code-unit-simple-path-expected-mismatch.html: Added.
     10        * fast/text/multi-code-unit-simple-path.html: Added.
     11
    1122021-02-04  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r272377 r272379  
     12021-02-04  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Supplementary code points (U+10000 - U+10FFFF) are not shaped correctly in the fast text codepath
     4        https://bugs.webkit.org/show_bug.cgi?id=221356
     5        <rdar://problem/72555297>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Supplementary code points are represented in UTF-16 as two adjacent (surrogate) code units. When we map code
     10        points to glyphs, we were originally mapping these two code units to a single glyph. However, shaping
     11        routines require that the number of code units and glyphs be equal, by injecting a 0 glyph for the trailing
     12        surrogate.
     13
     14        Luckily, we don't actually have to delete these extra 0 glyphs, because the shaping engine will do that for us.
     15
     16        Test: fast/text/multi-code-unit-simple-path.html
     17
     18        * platform/graphics/WidthIterator.cpp:
     19        (WebCore::WidthIterator::advanceInternal):
     20
    1212021-02-04  Megan Gardner  <megan_gardner@apple.com>
    222
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r266688 r272379  
    263263
    264264        glyphBuffer.add(glyph, *font, width, currentCharacterIndex);
     265#if !PLATFORM(COCOA) || USE(CTFONTSHAPEGLYPHS)
     266        // These 0 glyphs are needed by shapers if the source text has surrogate pairs.
     267        // However, CTFontTransformGlyphs() can't delete these 0 glyphs from the shaped text,
     268        // so we shouldn't add them in the first place if we're using that shaping routine.
     269        // Any other shaping routine should delete these glyphs from the shaped text.
     270        if (!U_IS_BMP(character))
     271            glyphBuffer.add(0, *font, 0, currentCharacterIndex + 1);
     272#endif
    265273
    266274        // Advance past the character we just dealt with.
Note: See TracChangeset for help on using the changeset viewer.