Arabic shaping is incorrect if ZWNJ exist
authorbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jul 2012 23:08:01 +0000 (23:08 +0000)
committerbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jul 2012 23:08:01 +0000 (23:08 +0000)
commit60ff6f21ac14083647be7a10dde3a00943a9970d
treedd722235a7f897a7b38d62fc2ddd5a2b50c9d8e0
parentb610aa77a61d33df24f14494de1e2a659521deea
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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121643 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj-expected.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/arabic-zwj-and-zwnj.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/ComplexTextController.cpp