Title: [219504] trunk
Revision
219504
Author
[email protected]
Date
2017-07-14 08:54:31 -0700 (Fri, 14 Jul 2017)

Log Message

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

Patch by Fujii Hironori <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219503 => 219504)


--- trunk/LayoutTests/ChangeLog	2017-07-14 12:06:15 UTC (rev 219503)
+++ trunk/LayoutTests/ChangeLog	2017-07-14 15:54:31 UTC (rev 219504)
@@ -1,3 +1,13 @@
+2017-07-14  Fujii Hironori  <[email protected]>
+
+        [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=174418
+
+        Reviewed by Michael Catanzaro.
+
+        * fast/text/international/vietnamese-nfd-expected.html: Added.
+        * fast/text/international/vietnamese-nfd.html: Added.
+
 2017-07-14  Aaron Chu  <[email protected]>
 
         AX: VoiceOver silent or skipping over time values on media player.

Added: trunk/LayoutTests/fast/text/international/vietnamese-nfd-expected.html (0 => 219504)


--- trunk/LayoutTests/fast/text/international/vietnamese-nfd-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/vietnamese-nfd-expected.html	2017-07-14 15:54:31 UTC (rev 219504)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+ body {
+     font-size: 30px;
+     font-family: Helvetica, sans;
+ }
+</style>
+<body>
+    ã ẫ ẵ ẽ ễ ĩ õ ỗ ỡ ũ ữ ỹ<br>
+    ạ ậ ặ ẹ ệ ị ọ ộ ợ ụ ự ỵ<br>
+    ả ẩ ẳ ẻ ể ỉ ỏ ổ ở ủ ử ỷ<br>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/international/vietnamese-nfd.html (0 => 219504)


--- trunk/LayoutTests/fast/text/international/vietnamese-nfd.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/vietnamese-nfd.html	2017-07-14 15:54:31 UTC (rev 219504)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<meta charset="utf-8">
+<style>
+ body {
+     font-size: 30px;
+     font-family: Helvetica, sans;
+ }
+</style>
+<body>
+    ã ẫ ẵ ẽ ễ ĩ õ ỗ ỡ ũ ữ ỹ<br>
+    ạ ậ ặ ẹ ệ ị ọ ộ ợ ụ ự ỵ<br>
+    ả ẩ ẳ ẻ ể ỉ ỏ ổ ở ủ ử ỷ<br>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (219503 => 219504)


--- trunk/Source/WebCore/ChangeLog	2017-07-14 12:06:15 UTC (rev 219503)
+++ trunk/Source/WebCore/ChangeLog	2017-07-14 15:54:31 UTC (rev 219504)
@@ -1,5 +1,24 @@
 2017-07-14  Fujii Hironori  <[email protected]>
 
+        [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=174418
+
+        Reviewed by Michael Catanzaro.
+
+        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.
+
+2017-07-14  Fujii Hironori  <[email protected]>
+
         [WinCairo] Build broken "Cannot open include file: 'GL/glext.h'" since Bug 172104
         https://bugs.webkit.org/show_bug.cgi?id=174492
 

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (219503 => 219504)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2017-07-14 12:06:15 UTC (rev 219503)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2017-07-14 15:54:31 UTC (rev 219504)
@@ -160,33 +160,6 @@
     return position;
 }
 
-static void normalizeCharacters(const TextRun& run, UChar* destination, unsigned length)
-{
-    unsigned position = 0;
-    bool error = false;
-    const UChar* source;
-    String stringFor8BitRun;
-    if (run.is8Bit()) {
-        stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
-        source = stringFor8BitRun.characters16();
-    } else
-        source = run.characters16();
-
-    while (position < length) {
-        UChar32 character;
-        unsigned nextPosition = position;
-        U16_NEXT(source, nextPosition, length, character);
-        // Don't normalize tabs as they are not treated as spaces for word-end.
-        if (FontCascade::treatAsSpace(character) && character != '\t')
-            character = ' ';
-        else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
-            character = zeroWidthSpace;
-        U16_APPEND(destination, position, length, character, error);
-        ASSERT_UNUSED(error, !error);
-        position = nextPosition;
-    }
-}
-
 HarfBuzzShaper::HarfBuzzShaper(const FontCascade* font, const TextRun& run)
     : m_font(font)
     , m_normalizedBufferLength(0)
@@ -197,9 +170,7 @@
     , m_padError(0)
     , m_letterSpacing(font->letterSpacing())
 {
-    m_normalizedBuffer = std::make_unique<UChar[]>(m_run.length() + 1);
-    m_normalizedBufferLength = m_run.length();
-    normalizeCharacters(m_run, m_normalizedBuffer.get(), m_normalizedBufferLength);
+    setNormalizedBuffer();
     setPadding(m_run.expansion());
     setFontFeatures();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to