Title: [121643] trunk
Revision
121643
Author
[email protected]
Date
2012-07-01 16:08:01 -0700 (Sun, 01 Jul 2012)

Log Message

Arabic shaping is incorrect if ZWNJ exist
https://bugs.webkit.org/show_bug.cgi?id=89843

Reviewed by Dan Bernstein.

Source/WebCore:

mac port treats ZWJ (zero-width-joiner) and ZWNJ (zero-width-non-joiner) as a part of combining
character sequence. This could cause a problem when the font doesn't have glyph mapping of ZWJ and ZWNJ.
Suppose the text to be rendered is "U+0645(MEEM) U+06CC(FARSI YEH) U+200C(ZWNJ)". In this case, U+0645
and U+06CC are rendered in isolated form if the font doesn't have a glyph for ZWNJ. They should be joined.

This patch changes handling of ZWJ and ZWNJ. Treats ZWJ and ZWNJ as base characters so that a complex text
run isn't separate at the point of ZWJ and ZWNJ even the font doesn't contain glyphs for them.
If ComplexTextController finds ZWJ, it doesn't split the current complex text run.

Test: platform/mac/fast/text/arabic-zwj-and-zwnj.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::advanceByCombiningCharacterSequence): Don't treat ZWJ and ZWNJ as a part of combining character sequence.
(WebCore::ComplexTextController::collectComplexTextRuns): Set fontData to nextFontData if the baseCharacter is ZWJ.

LayoutTests:

* platform/mac/fast/text/arabic-zwj-and-zwnj-expected.html: Added.
* platform/mac/fast/text/arabic-zwj-and-zwnj.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121642 => 121643)


--- trunk/LayoutTests/ChangeLog	2012-07-01 22:54:12 UTC (rev 121642)
+++ trunk/LayoutTests/ChangeLog	2012-07-01 23:08:01 UTC (rev 121643)
@@ -1,3 +1,13 @@
+2012-07-01  Kenichi Ishibashi  <[email protected]>
+
+        Arabic shaping is incorrect if ZWNJ exist
+        https://bugs.webkit.org/show_bug.cgi?id=89843
+
+        Reviewed by Dan Bernstein.
+
+        * platform/mac/fast/text/arabic-zwj-and-zwnj-expected.html: Added.
+        * platform/mac/fast/text/arabic-zwj-and-zwnj.html: Added.
+
 2012-07-01  Emil A Eklund  <[email protected]>
 
         Unreviewed rebaseline for mac post r121599.

Added: trunk/LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj-expected.html (0 => 121643)


--- trunk/LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj-expected.html	2012-07-01 23:08:01 UTC (rev 121643)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<head>
+</head>
+<p>The first word contains ZWJ. The first word should be identical with the second word.</p>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;&#x062e;&#x0648;&#x0631;
+</div>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;&#x062e;&#x0648;&#x0631;
+</div>
+
+<p>The last character of the first word is ZWNJ. The first word should be identical with the second word.</p>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;
+</div>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;
+</div>

Added: trunk/LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj.html (0 => 121643)


--- trunk/LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj.html	2012-07-01 23:08:01 UTC (rev 121643)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<head>
+</head>
+<p>The first word contains ZWJ. The first word should be identical with the second word.</p>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;&#x200d;&#x062e;&#x0648;&#x0631;
+</div>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;&#x062e;&#x0648;&#x0631;
+</div>
+
+<p>The last character of the first word is ZWNJ. The first word should be identical with the second word.</p>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;&#x200c;
+</div>
+<div style="font-size: 36pt;">
+&#x0645;&#x06cc;
+</div>

Modified: trunk/Source/WebCore/ChangeLog (121642 => 121643)


--- trunk/Source/WebCore/ChangeLog	2012-07-01 22:54:12 UTC (rev 121642)
+++ trunk/Source/WebCore/ChangeLog	2012-07-01 23:08:01 UTC (rev 121643)
@@ -1,3 +1,25 @@
+2012-07-01  Kenichi Ishibashi  <[email protected]>
+
+        Arabic shaping is incorrect if ZWNJ exist
+        https://bugs.webkit.org/show_bug.cgi?id=89843
+
+        Reviewed by Dan Bernstein.
+
+        mac port treats ZWJ (zero-width-joiner) and ZWNJ (zero-width-non-joiner) as a part of combining
+        character sequence. This could cause a problem when the font doesn't have glyph mapping of ZWJ and ZWNJ.
+        Suppose the text to be rendered is "U+0645(MEEM) U+06CC(FARSI YEH) U+200C(ZWNJ)". In this case, U+0645
+        and U+06CC are rendered in isolated form if the font doesn't have a glyph for ZWNJ. They should be joined.
+
+        This patch changes handling of ZWJ and ZWNJ. Treats ZWJ and ZWNJ as base characters so that a complex text
+        run isn't separate at the point of ZWJ and ZWNJ even the font doesn't contain glyphs for them.
+        If ComplexTextController finds ZWJ, it doesn't split the current complex text run.
+
+        Test: platform/mac/fast/text/arabic-zwj-and-zwnj.html
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::advanceByCombiningCharacterSequence): Don't treat ZWJ and ZWNJ as a part of combining character sequence.
+        (WebCore::ComplexTextController::collectComplexTextRuns): Set fontData to nextFontData if the baseCharacter is ZWJ.
+
 2012-07-01  Konrad Piascik  <[email protected]>
 
         [EFL] [GTK] [QT] fast/viewport/viewport-91.html is failing after r121555

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (121642 => 121643)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2012-07-01 22:54:12 UTC (rev 121642)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2012-07-01 23:08:01 UTC (rev 121643)
@@ -208,7 +208,7 @@
         UChar32 nextCharacter;
         int markLength = 0;
         U16_NEXT(iterator, markLength, end - iterator, nextCharacter);
-        if (!(U_GET_GC_MASK(nextCharacter) & U_GC_M_MASK) && nextCharacter != zeroWidthJoiner && nextCharacter != zeroWidthNonJoiner)
+        if (!(U_GET_GC_MASK(nextCharacter) & U_GC_M_MASK))
             break;
         markCount += markLength;
         iterator += markLength;
@@ -284,13 +284,17 @@
         }
 
         nextIsMissingGlyph = false;
+        if (baseCharacter == zeroWidthJoiner)
+            nextFontData = fontData;
 #if !PLATFORM(WX)
-        nextFontData = m_font.fontDataForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
-        if (!nextFontData) {
-            if (markCount)
-                nextFontData = systemFallbackFontData();
-            else
-                nextIsMissingGlyph = true;
+        else {
+            nextFontData = m_font.fontDataForCombiningCharacterSequence(cp + index, curr - cp - index, nextIsSmallCaps ? SmallCapsVariant : NormalVariant);
+            if (!nextFontData) {
+                if (markCount)
+                    nextFontData = systemFallbackFontData();
+                else
+                    nextIsMissingGlyph = true;
+            }
         }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to