Changeset 220797 in webkit


Ignore:
Timestamp:
Aug 16, 2017 9:36:35 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
https://bugs.webkit.org/show_bug.cgi?id=174418

Patch by Fujii Hironori <Fujii Hironori> on 2017-08-16
Reviewed by Michael Catanzaro.

Source/WebCore:

HarfBuzzShaper should normalize the input text before collecting
HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
the task. But, this function hasn't been called from anywhere
since Bug 90951.

Test: fast/text/international/vietnamese-nfd.html

imported/blink/fast/text/international/text-shaping-arabic-diffs.html

  • platform/graphics/harfbuzz/HarfBuzzShaper.cpp:

(WebCore::HarfBuzzShaper::HarfBuzzShaper):
Call setNormalizedBuffer instead of normalizeCharacters.
(WebCore::normalizeCharacters): Deleted.
(WebCore::normalizeSpacesAndMirrorChars) Use
FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.

LayoutTests:

  • fast/text/international/vietnamese-nfd-expected.html: Added.
  • fast/text/international/vietnamese-nfd.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220796 r220797  
     12017-08-16  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
     4        https://bugs.webkit.org/show_bug.cgi?id=174418
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * fast/text/international/vietnamese-nfd-expected.html: Added.
     9        * fast/text/international/vietnamese-nfd.html: Added.
     10
    1112017-08-16  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r220795 r220797  
     12017-08-16  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
     4        https://bugs.webkit.org/show_bug.cgi?id=174418
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        HarfBuzzShaper should normalize the input text before collecting
     9        HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
     10        the task. But, this function hasn't been called from anywhere
     11        since Bug 90951.
     12
     13        Test: fast/text/international/vietnamese-nfd.html
     14              imported/blink/fast/text/international/text-shaping-arabic-diffs.html
     15
     16        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
     17        (WebCore::HarfBuzzShaper::HarfBuzzShaper):
     18        Call setNormalizedBuffer instead of normalizeCharacters.
     19        (WebCore::normalizeCharacters): Deleted.
     20        (WebCore::normalizeSpacesAndMirrorChars) Use
     21        FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
     22        FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
     23
    1242017-08-16  Antti Koivisto  <antti@apple.com>
    225
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp

    r220746 r220797  
    161161}
    162162
    163 static void normalizeCharacters(const TextRun& run, UChar* destination, unsigned length)
    164 {
    165     unsigned position = 0;
    166     bool error = false;
    167     const UChar* source;
    168     String stringFor8BitRun;
    169     if (run.is8Bit()) {
    170         stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
    171         source = stringFor8BitRun.characters16();
    172     } else
    173         source = run.characters16();
    174 
    175     while (position < length) {
    176         UChar32 character;
    177         unsigned nextPosition = position;
    178         U16_NEXT(source, nextPosition, length, character);
    179         // Don't normalize tabs as they are not treated as spaces for word-end.
    180         if (FontCascade::treatAsSpace(character) && character != '\t')
    181             character = ' ';
    182         else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
    183             character = zeroWidthSpace;
    184         U16_APPEND(destination, position, length, character, error);
    185         ASSERT_UNUSED(error, !error);
    186         position = nextPosition;
    187     }
    188 }
    189 
    190163HarfBuzzShaper::HarfBuzzShaper(const FontCascade* font, const TextRun& run)
    191164    : m_font(font)
     
    198171    , m_letterSpacing(font->letterSpacing())
    199172{
    200     m_normalizedBuffer = std::make_unique<UChar[]>(m_run.length() + 1);
    201     m_normalizedBufferLength = m_run.length();
    202     normalizeCharacters(m_run, m_normalizedBuffer.get(), m_normalizedBufferLength);
     173    setNormalizedBuffer();
    203174    setPadding(m_run.expansion());
    204175    setFontFeatures();
     
    221192        if (FontCascade::treatAsSpace(character) && character != '\t')
    222193            character = ' ';
    223         else if (FontCascade::treatAsZeroWidthSpace(character))
     194        else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
    224195            character = zeroWidthSpace;
    225196        else if (normalizeMode == HarfBuzzShaper::NormalizeMirrorChars)
Note: See TracChangeset for help on using the changeset viewer.