Title: [138986] trunk
Revision
138986
Author
[email protected]
Date
2013-01-07 14:03:53 -0800 (Mon, 07 Jan 2013)

Log Message

Some characters are not rotated properly in vertical text
https://bugs.webkit.org/show_bug.cgi?id=105663
<rdar://problem/12738911>

Source/WebCore: 

Reviewed by Dan Bernstein.

Test: platform/mac/fast/text/vertical-no-sideways.html

* platform/graphics/Font.cpp:
(WebCore::Font::isCJKIdeographOrSymbol): Added several characters to the list.
* platform/graphics/FontFastPath.cpp:
(WebCore::shouldIgnoreRotation): Added
(WebCore::Font::glyphDataAndPageForNonCJKCharacterWithGlyphOrientation): Added logic to avoid
rotation for all the characters listed in shouldIgnoreRotation.

LayoutTests: 

Reviewed by Dan Bernstein. 

* platform/mac/fast/text/vertical-no-sideways.html: Added. 
* platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138985 => 138986)


--- trunk/LayoutTests/ChangeLog	2013-01-07 22:02:26 UTC (rev 138985)
+++ trunk/LayoutTests/ChangeLog	2013-01-07 22:03:53 UTC (rev 138986)
@@ -1,3 +1,14 @@
+2013-01-07  Enrica Casucci  <[email protected]> 
+
+        Some characters are not rotated properly in vertical text
+        https://bugs.webkit.org/show_bug.cgi?id=105663
+        <rdar://problem/12738911>
+
+        Reviewed by Dan Bernstein. 
+
+        * platform/mac/fast/text/vertical-no-sideways.html: Added. 
+        * platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt: Added.
+
 2013-01-07  Levi Weintraub  <[email protected]>
 
         Unreviewed gardening. Updating test expectations following r138717.

Added: trunk/LayoutTests/platform/mac/fast/text/vertical-no-sideways.html (0 => 138986)


--- trunk/LayoutTests/platform/mac/fast/text/vertical-no-sideways.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/vertical-no-sideways.html	2013-01-07 22:03:53 UTC (rev 138986)
@@ -0,0 +1,21 @@
+<style>
+    div { font-family: 'hiragino mincho pro'; font-size: 48px; }
+</style>
+<p>
+The glyphs in these two boxes should look the same, meaning that the ones in the blue box should not be rotated :
+</p>
+<div style="border: solid red 1px">
+    &#x02018;&#x02019;&#x000A7;&#x000A9;&#x000AE;&#x000B6;&#x000BC;&#x000BD;&#x000BE;
+    &#x002E5;&#x002E6;&#x002E7;&#x002E8;&#x002E9;&#x02044;&#x0210F;&#x02122;&#x02126;
+    &#x02127;&#x0212E;&#x02135;&#x02153;&#x02154;&#x02155;&#x0215B;&#x0215C;&#x0215D;
+    &#x0215E;&#x02305;&#x02306;&#x02318;&#x025CA;
+</div>
+<div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
+    &#x02018;&#x02019;&#x000A7;&#x000A9;&#x000AE;&#x000B6;&#x000BC;&#x000BD;&#x000BE;</div>
+<div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
+    &#x002E5;&#x002E6;&#x002E7;&#x002E8;&#x002E9;&#x02044;&#x0210F;&#x02122;&#x02126;</div>
+<div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
+    &#x02127;&#x0212E;&#x02135;&#x02153;&#x02154;&#x02155;&#x0215B;&#x0215C;&#x0215D;</div>
+<div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
+    &#x0215E;&#x02305;&#x02306;&#x02318;&#x025CA;
+</div>

Added: trunk/LayoutTests/platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt (0 => 138986)


--- trunk/LayoutTests/platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt	2013-01-07 22:03:53 UTC (rev 138986)
@@ -0,0 +1,26 @@
+layer at (0,0) size 785x1521
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1521
+  RenderBlock {HTML} at (0,0) size 785x1522
+    RenderBody {BODY} at (8,8) size 769x1506
+      RenderBlock {P} at (0,0) size 769x18
+        RenderText {#text} at (0,0) size 716x18
+          text run at (0,0) width 716: "The glyphs in these two boxes should look the same, meaning that the ones in the blue box should not be rotated :"
+      RenderBlock {DIV} at (0,34) size 769x146 [border: (1px solid #FF0000)]
+        RenderText {#text} at (1,13) size 564x120
+          text run at (1,13) width 306: "\x{2018}\x{2019}\x{A7}\x{A9}\x{AE}\x{B6}\x{BC}\x{BD}\x{BE} "
+          text run at (307,13) width 224: "\x{2E5}\x{2E6}\x{2E7}\x{2E8}\x{2E9}\x{2044}\x{210F}\x{2122}\x{2126}"
+          text run at (1,85) width 389: "\x{2127}\x{212E}\x{2135}\x{2153}\x{2154}\x{2155}\x{215B}\x{215C}\x{215D} "
+          text run at (390,85) width 175: "\x{215E}\x{2305}\x{2306}\x{2318}\x{25CA}"
+      RenderBlock {DIV} at (0,180) size 74x434 [border: (1px solid #0000FF)]
+        RenderText {#text} at (13,1) size 48x432
+          text run at (13,1) width 432: "\x{2018}\x{2019}\x{A7}\x{A9}\x{AE}\x{B6}\x{BC}\x{BD}\x{BE}"
+      RenderBlock {DIV} at (0,614) size 74x226 [border: (1px solid #0000FF)]
+        RenderText {#text} at (13,1) size 48x224
+          text run at (13,1) width 224: "\x{2E5}\x{2E6}\x{2E7}\x{2E8}\x{2E9}\x{2044}\x{210F}\x{2122}\x{2126}"
+      RenderBlock {DIV} at (0,840) size 74x434 [border: (1px solid #0000FF)]
+        RenderText {#text} at (13,1) size 48x432
+          text run at (13,1) width 432: "\x{2127}\x{212E}\x{2135}\x{2153}\x{2154}\x{2155}\x{215B}\x{215C}\x{215D}"
+      RenderBlock {DIV} at (0,1274) size 74x232 [border: (1px solid #0000FF)]
+        RenderText {#text} at (13,1) size 48x230
+          text run at (13,1) width 230: "\x{215E}\x{2305}\x{2306}\x{2318}\x{25CA}"

Modified: trunk/Source/WebCore/ChangeLog (138985 => 138986)


--- trunk/Source/WebCore/ChangeLog	2013-01-07 22:02:26 UTC (rev 138985)
+++ trunk/Source/WebCore/ChangeLog	2013-01-07 22:03:53 UTC (rev 138986)
@@ -1,3 +1,20 @@
+2013-01-07  Enrica Casucci  <[email protected]>
+
+        Some characters are not rotated properly in vertical text
+        https://bugs.webkit.org/show_bug.cgi?id=105663
+        <rdar://problem/12738911>
+
+        Reviewed by Dan Bernstein.
+
+        Test: platform/mac/fast/text/vertical-no-sideways.html
+
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::isCJKIdeographOrSymbol): Added several characters to the list.
+        * platform/graphics/FontFastPath.cpp:
+        (WebCore::shouldIgnoreRotation): Added
+        (WebCore::Font::glyphDataAndPageForNonCJKCharacterWithGlyphOrientation): Added logic to avoid
+        rotation for all the characters listed in shouldIgnoreRotation.
+    
 2013-01-07  Mike West  <[email protected]>
 
         Make the IFRAME_SEAMLESS flag runtime-enabled.

Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (138985 => 138986)


--- trunk/Source/WebCore/platform/graphics/Font.cpp	2013-01-07 22:02:26 UTC (rev 138985)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp	2013-01-07 22:03:53 UTC (rev 138986)
@@ -569,15 +569,88 @@
     if ((c == 0x2C7) || (c == 0x2CA) || (c == 0x2CB) || (c == 0x2D9))
         return true;
 
+    if ((c == 0x2020) || (c == 0x2021) || (c == 0x2030) || (c == 0x203B) || (c == 0x203C)
+        || (c == 0x2042) || (c == 0x2047) || (c == 0x2048) || (c == 0x2049) || (c == 0x2051)
+        || (c == 0x20DD) || (c == 0x20DE) || (c == 0x2100) || (c == 0x2103) || (c == 0x2105)
+        || (c == 0x2109) || (c == 0x210A) || (c == 0x2113) || (c == 0x2116) || (c == 0x2121)
+        || (c == 0x212B) || (c == 0x213B) || (c == 0x2150) || (c == 0x2151) || (c == 0x2152))
+        return true;
+
+    if (c >= 0x2156 && c <= 0x215A)
+        return true;
+
+    if (c >= 0x2160 && c <= 0x216B)
+        return true;
+
+    if (c >= 0x2170 && c <= 0x217B)
+        return true;
+
+    if ((c == 0x217F) || (c == 0x2189) || (c == 0x2307) || (c == 0x2312) || (c == 0x23BE) || (c == 0x23BF))
+        return true;
+
+    if (c >= 0x23C0 && c <= 0x23CC)
+        return true;
+
+    if ((c == 0x23CE) || (c == 0x2423))
+        return true;
+
+    if (c >= 0x2460 && c <= 0x2492)
+        return true;
+
+    if (c >= 0x249C && c <= 0x24FF)
+        return true;
+
+    if ((c == 0x25A0) || (c == 0x25A1) || (c == 0x25A2) || (c == 0x25AA) || (c == 0x25AB))
+        return true;
+
+    if ((c == 0x25B1) || (c == 0x25B2) || (c == 0x25B3) || (c == 0x25B6) || (c == 0x25B7) || (c == 0x25BC) || (c == 0x25BD))
+        return true;
+    
+    if ((c == 0x25C0) || (c == 0x25C1) || (c == 0x25C6) || (c == 0x25C7) || (c == 0x25C9) || (c == 0x25CB) || (c == 0x25CC))
+        return true;
+
+    if (c >= 0x25CE && c <= 0x25D3)
+        return true;
+
+    if (c >= 0x25E2 && c <= 0x25E6)
+        return true;
+
+    if (c == 0x25EF)
+        return true;
+
+    if (c >= 0x2600 && c <= 0x2603)
+        return true;
+
+    if ((c == 0x2605) || (c == 0x2606) || (c == 0x260E) || (c == 0x2616) || (c == 0x2617) || (c == 0x2640) || (c == 0x2642))
+        return true;
+
+    if (c >= 0x2660 && c <= 0x266F)
+        return true;
+
+    if (c >= 0x2672 && c <= 0x267D)
+        return true;
+
+    if ((c == 0x26A0) || (c == 0x26BD) || (c == 0x26BE) || (c == 0x2713) || (c == 0x271A) || (c == 0x273F) || (c == 0x2740) || (c == 0x2756))
+        return true;
+
+    if (c >= 0x2776 && c <= 0x277F)
+        return true;
+
+    if (c == 0x2B1A)
+        return true;
+
     // Ideographic Description Characters.
     if (c >= 0x2FF0 && c <= 0x2FFF)
         return true;
     
-    // CJK Symbols and Punctuation.
-    if (c >= 0x3000 && c <= 0x303F)
+    // CJK Symbols and Punctuation, excluding 0x3030.
+    if (c >= 0x3000 && c < 0x3030)
         return true;
-   
-    // Hiragana 
+
+    if (c > 0x3030 && c <= 0x303F)
+        return true;
+
+    // Hiragana
     if (c >= 0x3040 && c <= 0x309F)
         return true;
 
@@ -588,7 +661,10 @@
     // Bopomofo
     if (c >= 0x3100 && c <= 0x312F)
         return true;
-    
+
+    if (c >= 0x3190 && c <= 0x319F)
+        return true;
+
     // Bopomofo Extended
     if (c >= 0x31A0 && c <= 0x31BF)
         return true;
@@ -600,17 +676,41 @@
     // CJK Compatibility.
     if (c >= 0x3300 && c <= 0x33FF)
         return true;
-    
+
+    if (c >= 0xF860 && c <= 0xF862)
+        return true;
+
     // CJK Compatibility Forms.
     if (c >= 0xFE30 && c <= 0xFE4F)
         return true;
 
+    if ((c == 0xFE10) || (c == 0xFE11) || (c == 0xFE12) || (c == 0xFE19))
+        return true;
+
+    if ((c == 0xFF0D) || (c == 0xFF1B) || (c == 0xFF1C) || (c == 0xFF1E))
+        return false;
+
     // Halfwidth and Fullwidth Forms
     // Usually only used in CJK
     if (c >= 0xFF00 && c <= 0xFFEF)
         return true;
 
     // Emoji.
+    if (c == 0x1F100)
+        return true;
+
+    if (c >= 0x1F110 && c <= 0x1F129)
+        return true;
+
+    if (c >= 0x1F130 && c <= 0x1F149)
+        return true;
+
+    if (c >= 0x1F150 && c <= 0x1F169)
+        return true;
+
+    if (c >= 0x1F170 && c <= 0x1F189)
+        return true;
+
     if (c >= 0x1F200 && c <= 0x1F6F)
         return true;
 

Modified: trunk/Source/WebCore/platform/graphics/FontFastPath.cpp (138985 => 138986)


--- trunk/Source/WebCore/platform/graphics/FontFastPath.cpp	2013-01-07 22:02:26 UTC (rev 138985)
+++ trunk/Source/WebCore/platform/graphics/FontFastPath.cpp	2013-01-07 22:03:53 UTC (rev 138986)
@@ -42,9 +42,65 @@
 
 namespace WebCore {
 
+static bool shouldIgnoreRotation(UChar32 character)
+{
+    switch (character) {
+    case 0x02018:
+    case 0x02019:
+    case 0x000A7:
+    case 0x000A9:
+    case 0x000AE:
+    case 0x000B6:
+    case 0x000BC:
+    case 0x000BD:
+    case 0x000BE:
+    case 0x002E5:
+    case 0x002E6:
+    case 0x002E7:
+    case 0x002E8:
+    case 0x002E9:
+    case 0x02044:
+    case 0x0210F:
+    case 0x02122:
+    case 0x02126:
+    case 0x02127:
+    case 0x0212E:
+    case 0x02135:
+    case 0x02153:
+    case 0x02154:
+    case 0x02155:
+    case 0x0215B:
+    case 0x0215C:
+    case 0x0215D:
+    case 0x0215E:
+    case 0x02305:
+    case 0x02306:
+    case 0x02318:
+    case 0x025CA:
+        return true;
+    
+    default:
+        return false;
+    }
+}
+
 static inline std::pair<GlyphData, GlyphPage*> glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, GlyphData& data, GlyphPage* page, unsigned pageNumber)
 {
-    if (orientation == NonCJKGlyphOrientationVerticalRight) {
+    if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) {
+        RefPtr<SimpleFontData> uprightFontData = data.fontData->uprightOrientationFontData();
+        GlyphPageTreeNode* uprightNode = GlyphPageTreeNode::getRootChild(uprightFontData.get(), pageNumber);
+        GlyphPage* uprightPage = uprightNode->page();
+        if (uprightPage) {
+            GlyphData uprightData = uprightPage->glyphDataForCharacter(character);
+            // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright.
+            if (data.glyph == uprightData.glyph)
+                return make_pair(data, page);
+            // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that
+            // glyph, so we fall back to the upright data and use the horizontal glyph.
+            if (uprightData.fontData)
+                return make_pair(uprightData, uprightPage);
+        }
+    } else if (orientation == NonCJKGlyphOrientationVerticalRight) {
         RefPtr<SimpleFontData> verticalRightFontData = data.fontData->verticalRightOrientationFontData();
         GlyphPageTreeNode* verticalRightNode = GlyphPageTreeNode::getRootChild(verticalRightFontData.get(), pageNumber);
         GlyphPage* verticalRightPage = verticalRightNode->page();
@@ -58,20 +114,6 @@
             if (verticalRightData.fontData)
                 return make_pair(verticalRightData, verticalRightPage);
         }
-    } else if (orientation == NonCJKGlyphOrientationUpright) {
-        RefPtr<SimpleFontData> uprightFontData = data.fontData->uprightOrientationFontData();
-        GlyphPageTreeNode* uprightNode = GlyphPageTreeNode::getRootChild(uprightFontData.get(), pageNumber);
-        GlyphPage* uprightPage = uprightNode->page();
-        if (uprightPage) {
-            GlyphData uprightData = uprightPage->glyphDataForCharacter(character);
-            // If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright.
-            if (data.glyph == uprightData.glyph)
-                return make_pair(data, page);
-            // The glyphs are distinct, meaning that the font has a vertical-right glyph baked into it. We can't use that
-            // glyph, so we fall back to the upright data and use the horizontal glyph.
-            if (uprightData.fontData)
-                return make_pair(uprightData, uprightPage);
-        }
     }
     return make_pair(data, page);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to