<rdar://problem/11785743> [mac] Non-BMP characters in vertical text appear as missing...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Jul 2012 00:08:47 +0000 (00:08 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Jul 2012 00:08:47 +0000 (00:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90349

Reviewed by Dean Jackson.

Source/WebCore:

Test: platform/mac/fast/text/vertical-surrogate-pair.html

* platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
(WebCore::GlyphPage::fill): When calling wkGetVerticalGlyphsForCharacters or
CTFontGetGlyphsForCharacters with a buffer consisting of surrogate pair, account for those
functions’ behavior of placing glyphs at indices corresponding to the first character of
each pair.

LayoutTests:

* platform/mac/fast/text/vertical-surrogate-pair.html: Added.
* platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.png: Added.
* platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121645 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/text/vertical-surrogate-pair.html [new file with mode: 0644]
LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp

index c393376..791a27e 100644 (file)
@@ -1,3 +1,14 @@
+2012-07-01  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/11785743> [mac] Non-BMP characters in vertical text appear as missing glyphs
+        https://bugs.webkit.org/show_bug.cgi?id=90349
+
+        Reviewed by Dean Jackson.
+
+        * platform/mac/fast/text/vertical-surrogate-pair.html: Added.
+        * platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.png: Added.
+        * platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.txt: Added.
+
 2012-07-01  Kenichi Ishibashi  <bashi@chromium.org>
 
         Arabic shaping is incorrect if ZWNJ exist
diff --git a/LayoutTests/platform/mac/fast/text/vertical-surrogate-pair.html b/LayoutTests/platform/mac/fast/text/vertical-surrogate-pair.html
new file mode 100644 (file)
index 0000000..814992f
--- /dev/null
@@ -0,0 +1,8 @@
+<style>
+    div { font-family: 'hiragino mincho pro'; font-size: 48px; }
+</style>
+<p>
+    These two glyphs should look the same:
+</p>
+<div>&#x20b9f;</div>
+<div style="-webkit-writing-mode: vertical-lr;">&#x20b9f;</div>
diff --git a/LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.png b/LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.png
new file mode 100644 (file)
index 0000000..f346058
Binary files /dev/null and b/LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.png differ
diff --git a/LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.txt b/LayoutTests/platform/mac/platform/mac/fast/text/vertical-surrogate-pair-expected.txt
new file mode 100644 (file)
index 0000000..48ec2e3
--- /dev/null
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 253x18
+          text run at (0,0) width 253: "These two glyphs should look the same:"
+      RenderBlock {DIV} at (0,34) size 784x72
+        RenderText {#text} at (0,12) size 48x48
+          text run at (0,12) width 48: "\x{D842}\x{DF9F}"
+      RenderBlock {DIV} at (0,106) size 72x49
+        RenderText {#text} at (12,0) size 48x49
+          text run at (12,0) width 49: "\x{D842}\x{DF9F}"
index 443d101..439d05a 100644 (file)
@@ -1,3 +1,18 @@
+2012-07-01  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/11785743> [mac] Non-BMP characters in vertical text appear as missing glyphs
+        https://bugs.webkit.org/show_bug.cgi?id=90349
+
+        Reviewed by Dean Jackson.
+
+        Test: platform/mac/fast/text/vertical-surrogate-pair.html
+
+        * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
+        (WebCore::GlyphPage::fill): When calling wkGetVerticalGlyphsForCharacters or
+        CTFontGetGlyphsForCharacters with a buffer consisting of surrogate pair, account for those
+        functions’ behavior of placing glyphs at indices corresponding to the first character of
+        each pair.
+
 2012-07-01  Kenichi Ishibashi  <bashi@chromium.org>
 
         Arabic shaping is incorrect if ZWNJ exist
index 98a53f9..45a6691 100644 (file)
@@ -68,11 +68,14 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
         }
     } else if (!fontData->platformData().isCompositeFontReference() && ((fontData->platformData().widthVariant() == RegularWidth) ? wkGetVerticalGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength)
                : CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength))) {
+        // When buffer consists of surrogate pairs, wkGetVerticalGlyphsForCharacters and CTFontGetGlyphsForCharacters
+        // place the glyphs at indices corresponding to the first character of each pair.
+        unsigned glyphStep = bufferLength / length;
         for (unsigned i = 0; i < length; ++i) {
-            if (!glyphs[i])
+            if (!glyphs[i * glyphStep])
                 setGlyphDataForIndex(offset + i, 0, 0);
             else {
-                setGlyphDataForIndex(offset + i, glyphs[i], fontData);
+                setGlyphDataForIndex(offset + i, glyphs[i * glyphStep], fontData);
                 haveGlyphs = true;
             }
         }