Changeset 219504 in webkit


Ignore:
Timestamp:
Jul 14, 2017 8:54:31 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-07-14
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 108077.

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

  • platform/graphics/harfbuzz/HarfBuzzShaper.cpp:

(WebCore::HarfBuzzShaper::HarfBuzzShaper):
Call setNormalizedBuffer instead of normalizeCharacters.
(WebCore::normalizeCharacters): Deleted.

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

    r219500 r219504  
     12017-07-14  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-07-14  Aaron Chu  <aaron_chu@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r219503 r219504  
     12017-07-14  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 108077.
     12
     13        Test: fast/text/international/vietnamese-nfd.html
     14
     15        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
     16        (WebCore::HarfBuzzShaper::HarfBuzzShaper):
     17        Call setNormalizedBuffer instead of normalizeCharacters.
     18        (WebCore::normalizeCharacters): Deleted.
     19
    1202017-07-14  Fujii Hironori  <Hironori.Fujii@sony.com>
    221
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp

    r215754 r219504  
    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();
Note: See TracChangeset for help on using the changeset viewer.