Changeset 145854 in webkit


Ignore:
Timestamp:
Mar 14, 2013 3:43:27 PM (11 years ago)
Author:
enrica@apple.com
Message:

Character orientation should follow UTR50 specs for vertical layout.
https://bugs.webkit.org/show_bug.cgi?id=112213
<rdar://problem/12880943>

Reviewed by Ryosuke Niwa.

Source/WebCore:

platform/mac/fast/text/vertical-no-sideways.html: Modified to cover samples
of the additional character ranges that should not be rotated in vertical layout.
Added pixel results.

This patch modifies shouldIgnoreRotation to include all the characters that
should not be rotated sideways in vertical layout according to the UTR50 draft 6
specifications. It also fixes rotation for Emojii.

  • platform/graphics/FontFastPath.cpp:

(WebCore::shouldIgnoreRotation):
(WebCore::isInRange): Added.

  • platform/graphics/mac/FontMac.mm:

(WebCore::showGlyphsWithAdvances): Adds the proper transforms to ensure
Emojii also are drawn correctly upright.

LayoutTests:

  • platform/mac/fast/text/vertical-no-sideways.html: Modified to cover samples

of the additional character ranges that should not be rotated in vertical layout.

  • platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt:
  • platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.png: Added.
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r145850 r145854  
     12013-03-14  Enrica Casucci  <enrica@apple.com>
     2
     3        Character orientation should follow UTR50 specs for vertical layout.
     4        https://bugs.webkit.org/show_bug.cgi?id=112213
     5        <rdar://problem/12880943>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * platform/mac/fast/text/vertical-no-sideways.html: Modified to cover samples
     10        of the additional character ranges that should not be rotated in vertical layout.
     11        * platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt:
     12        * platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.png: Added.
     13
    1142013-03-14  Kenneth Russell  <kbr@google.com>
    215
  • trunk/LayoutTests/platform/mac/fast/text/vertical-no-sideways.html

    r138986 r145854  
    1 <style>
    2     div { font-family: 'hiragino mincho pro'; font-size: 48px; }
    3 </style>
    4 <p>
    5 The glyphs in these two boxes should look the same, meaning that the ones in the blue box should not be rotated :
    6 </p>
    7 <div style="border: solid red 1px">
    8     &#x02018;&#x02019;&#x000A7;&#x000A9;&#x000AE;&#x000B6;&#x000BC;&#x000BD;&#x000BE;
    9     &#x002E5;&#x002E6;&#x002E7;&#x002E8;&#x002E9;&#x02044;&#x0210F;&#x02122;&#x02126;
    10     &#x02127;&#x0212E;&#x02135;&#x02153;&#x02154;&#x02155;&#x0215B;&#x0215C;&#x0215D;
    11     &#x0215E;&#x02305;&#x02306;&#x02318;&#x025CA;
     1<div style="font-family: 'Lucida grande'; font-size: 24px; border: solid red 1px; letter-spacing: 15px;">
     2    &#x000A7;&#x000A9;&#x000AE;&#x000B6;&#x000BC;&#x000BD;&#x000BE;<br>
     3    &#x002E5;&#x002E6;&#x002E7;&#x002E8;&#x002E9;&#x002EA;&#x002EB;<br>
     4    &#x01100;&#x01101;&#x01401;&#x01402;&#x01800;&#x01801;<br>
     5    &#x02016;&#x02018;&#x02019;&#x02020;&#x02021;&#x02030;&#x02031;<br>
     6    &#x0203B;&#x0203C;&#x0203D;&#x02042;&#x02044;&#x02047;&#x02048;&#x02049;&#x02051;<br>
     7    &#x02100;&#x02101;&#x02116;&#x02117;&#x02119;&#x0211A;&#x02130;&#x02131;&#x02133;&#x02134;&#x0213E;&#x0213F;<br>
     8    &#x02145;&#x02146;&#x02149;&#x0214A;&#x0214D;<br>
     9    &#x02300;&#x02307;&#x0230C;&#x0231F;&#x02322;&#x0232B&#x0237D;&#x0239A;
     10    &#x023B4;&#x023B6;&#x023BA;&#x023CF;&#x023D1;&#x023DB;&#x023E2;&#x024FF;<br>
     11    &#x025A0;&#x02619;&#x02620;&#x02767;&#x02776;&#x02793;&#x02B12;&#x02B2F;&#x02E80;&#x02007;<br>
     12    &#x03012;&#x03013;&#x03020;&#x0302F;&#x03031;&#x0309F;&#x030A1;&#x030FB;&#x030FD;<br>
     13    &#x0FE10;&#x0FE30;&#x0FE48;&#x0FE50;&#x0FE57;&#x0FE5F;&#x0FE62;&#x0FE6;<br>
     14    &#x0FF01;&#x0FF07;&#x0FF0A;&#x0FF0C;&#x0FF0E;&#x0FF19;&#x0FF1F;&#x0FF3A;&#x0FF3C;&#x0FF3E;<br>
     15    &#x0FF40;&#x0FF5A;&#x0FFE0;&#x0FFE2;&#x0FFE4;&#x0FFFD;&#x1D300;&#x1F64F;&#x1F680;<br>
    1216</div>
    13 <div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
    14     &#x02018;&#x02019;&#x000A7;&#x000A9;&#x000AE;&#x000B6;&#x000BC;&#x000BD;&#x000BE;</div>
    15 <div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
    16     &#x002E5;&#x002E6;&#x002E7;&#x002E8;&#x002E9;&#x02044;&#x0210F;&#x02122;&#x02126;</div>
    17 <div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
    18     &#x02127;&#x0212E;&#x02135;&#x02153;&#x02154;&#x02155;&#x0215B;&#x0215C;&#x0215D;</div>
    19 <div style="border: solid blue 1px; -webkit-writing-mode: vertical-lr;">
    20     &#x0215E;&#x02305;&#x02306;&#x02318;&#x025CA;
     17<div style="font-family: 'Lucida grande'; font-size: 24px; border: solid blue 1px; -webkit-writing-mode: vertical-lr; -webkit-column-progression: normal; letter-spacing: 15px;">
     18    &#x000A7;&#x000A9;&#x000AE;&#x000B6;&#x000BC;&#x000BD;&#x000BE;<br>
     19    &#x002E5;&#x002E6;&#x002E7;&#x002E8;&#x002E9;&#x002EA;&#x002EB;<br>
     20    &#x01100;&#x01101;&#x01401;&#x01402;&#x01800;&#x01801;<br>
     21    &#x02016;&#x02018;&#x02019;&#x02020;&#x02021;&#x02030;&#x02031;<br>
     22    &#x0203B;&#x0203C;&#x0203D;&#x02042;&#x02044;&#x02047;&#x02048;&#x02049;&#x02051;<br>
     23    &#x02100;&#x02101;&#x02116;&#x02117;&#x02119;&#x0211A;&#x02130;&#x02131;&#x02133;&#x02134;&#x0213E;&#x0213F;<br>
     24    &#x02145;&#x02146;&#x02149;&#x0214A;&#x0214D;<br>
     25    &#x02300;&#x02307;&#x0230C;&#x0231F;&#x02322;&#x0232B&#x0237D;&#x0239A;
     26    &#x023B4;&#x023B6;&#x023BA;&#x023CF;&#x023D1;&#x023DB;&#x023E2;&#x024FF;<br>
     27    &#x025A0;&#x02619;&#x02620;&#x02767;&#x02776;&#x02793;&#x02B12;&#x02B2F;&#x02E80;&#x02007;<br>
     28    &#x03012;&#x03013;&#x03020;&#x0302F;&#x03031;&#x0309F;&#x030A1;&#x030FB;&#x030FD;<br>
     29    &#x0FE10;&#x0FE30;&#x0FE48;&#x0FE50;&#x0FE57;&#x0FE5F;&#x0FE62;&#x0FE6;<br>
     30    &#x0FF01;&#x0FF07;&#x0FF0A;&#x0FF0C;&#x0FF0E;&#x0FF19;&#x0FF1F;&#x0FF3A;&#x0FF3C;&#x0FF3E;<br>
     31    &#x0FF40;&#x0FF5A;&#x0FFE0;&#x0FFE2;&#x0FFE4;&#x0FFFD;&#x1D300;&#x1F64F;&#x1F680;<br>
    2132</div>
     33
     34
  • trunk/LayoutTests/platform/mac/platform/mac/fast/text/vertical-no-sideways-expected.txt

    r138986 r145854  
    1 layer at (0,0) size 785x1521
     1layer at (0,0) size 785x953
    22  RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x1521
    4   RenderBlock {HTML} at (0,0) size 785x1522
    5     RenderBody {BODY} at (8,8) size 769x1506
    6       RenderBlock {P} at (0,0) size 769x18
    7         RenderText {#text} at (0,0) size 716x18
    8           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 :"
    9       RenderBlock {DIV} at (0,34) size 769x146 [border: (1px solid #FF0000)]
    10         RenderText {#text} at (1,13) size 564x120
    11           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} "
    12           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}"
    13           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} "
    14           text run at (390,85) width 175: "\x{215E}\x{2305}\x{2306}\x{2318}\x{25CA}"
    15       RenderBlock {DIV} at (0,180) size 74x434 [border: (1px solid #0000FF)]
    16         RenderText {#text} at (13,1) size 48x432
    17           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}"
    18       RenderBlock {DIV} at (0,614) size 74x226 [border: (1px solid #0000FF)]
    19         RenderText {#text} at (13,1) size 48x224
    20           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}"
    21       RenderBlock {DIV} at (0,840) size 74x434 [border: (1px solid #0000FF)]
    22         RenderText {#text} at (13,1) size 48x432
    23           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}"
    24       RenderBlock {DIV} at (0,1274) size 74x232 [border: (1px solid #0000FF)]
    25         RenderText {#text} at (13,1) size 48x230
    26           text run at (13,1) width 230: "\x{215E}\x{2305}\x{2306}\x{2318}\x{25CA}"
     3layer at (0,0) size 785x953
     4  RenderBlock {HTML} at (0,0) size 785x953
     5    RenderBody {BODY} at (8,8) size 769x937
     6      RenderBlock {DIV} at (0,0) size 769x442 [border: (1px solid #FF0000)]
     7        RenderText {#text} at (1,1) size 235x28
     8          text run at (1,1) width 235: "\x{A7}\x{A9}\x{AE}\x{B6}\x{BC}\x{BD}\x{BE}"
     9        RenderBR {BR} at (235,24) size 1x0
     10        RenderText {#text} at (1,29) size 170x28
     11          text run at (1,29) width 170: "\x{2E5}\x{2E6}\x{2E7}\x{2E8}\x{2E9}\x{2EA}\x{2EB}"
     12        RenderBR {BR} at (170,52) size 1x0
     13        RenderText {#text} at (1,60) size 187x28
     14          text run at (1,60) width 187: "\x{1100}\x{1101}\x{1401}\x{1402}\x{1800}\x{1801}"
     15        RenderBR {BR} at (188,83) size 0x0
     16        RenderText {#text} at (1,90) size 222x28
     17          text run at (1,90) width 222: "\x{2016}\x{2018}\x{2019}\x{2020}\x{2021}\x{2030}\x{2031}"
     18        RenderBR {BR} at (222,113) size 1x0
     19        RenderText {#text} at (1,118) size 247x28
     20          text run at (1,118) width 247: "\x{203B}\x{203C}\x{203D}\x{2042}\x{2044}\x{2047}\x{2048}\x{2049}\x{2051}"
     21        RenderBR {BR} at (247,141) size 1x0
     22        RenderText {#text} at (1,150) size 392x28
     23          text run at (1,150) width 392: "\x{2100}\x{2101}\x{2116}\x{2117}\x{2119}\x{211A}\x{2130}\x{2131}\x{2133}\x{2134}\x{213E}\x{213F}"
     24        RenderBR {BR} at (392,173) size 1x0
     25        RenderText {#text} at (1,188) size 150x28
     26          text run at (1,188) width 150: "\x{2145}\x{2146}\x{2149}\x{214A}\x{214D}"
     27        RenderBR {BR} at (151,211) size 0x0
     28        RenderText {#text} at (1,226) size 568x28
     29          text run at (1,226) width 282: "\x{2300}\x{2307}\x{230C}\x{231F}\x{2322}\x{232B}\x{237D}\x{239A} "
     30          text run at (282,226) width 287: "\x{23B4}\x{23B6}\x{23BA}\x{23CF}\x{23D1}\x{23DB}\x{23E2}\x{24FF}"
     31        RenderBR {BR} at (568,249) size 1x0
     32        RenderText {#text} at (1,263) size 319x28
     33          text run at (1,263) width 319: "\x{25A0}\x{2619}\x{2620}\x{2767}\x{2776}\x{2793}\x{2B12}\x{2B2F}\x{2E80}\x{2007}"
     34        RenderBR {BR} at (319,286) size 1x0
     35        RenderText {#text} at (1,301) size 327x28
     36          text run at (1,301) width 327: "\x{3012}\x{3013}\x{3020}\x{302F}\x{3031}\x{309F}\x{30A1}\x{30FB}\x{30FD}"
     37        RenderBR {BR} at (328,324) size 0x0
     38        RenderText {#text} at (1,337) size 312x28
     39          text run at (1,337) width 312: "\x{FE10}\x{FE30}\x{FE48}\x{FE50}\x{FE57}\x{FE5F}\x{FE62}\x{FE6}"
     40        RenderBR {BR} at (313,360) size 0x0
     41        RenderText {#text} at (1,373) size 390x28
     42          text run at (1,373) width 390: "\x{FF01}\x{FF07}\x{FF0A}\x{FF0C}\x{FF0E}\x{FF19}\x{FF1F}\x{FF3A}\x{FF3C}\x{FF3E}"
     43        RenderBR {BR} at (391,396) size 0x0
     44        RenderText {#text} at (1,409) size 349x28
     45          text run at (1,409) width 349: "\x{FF40}\x{FF5A}\x{FFE0}\x{FFE2}\x{FFE4}\x{FFFD}\x{D834}\x{DF00}\x{D83D}\x{DE4F}\x{D83D}\x{DE80}"
     46        RenderBR {BR} at (349,432) size 1x0
     47      RenderBlock {DIV} at (0,442) size 438x495 [border: (1px solid #0000FF)]
     48        RenderText {#text} at (1,1) size 28x256
     49          text run at (1,1) width 256: "\x{A7}\x{A9}\x{AE}\x{B6}\x{BC}\x{BD}\x{BE}"
     50        RenderBR {BR} at (6,256) size 0x1
     51        RenderText {#text} at (29,1) size 28x219
     52          text run at (29,1) width 219: "\x{2E5}\x{2E6}\x{2E7}\x{2E8}\x{2E9}\x{2EA}\x{2EB}"
     53        RenderBR {BR} at (34,219) size 0x1
     54        RenderText {#text} at (59,1) size 28x197
     55          text run at (59,1) width 197: "\x{1100}\x{1101}\x{1401}\x{1402}\x{1800}\x{1801}"
     56        RenderBR {BR} at (73,198) size 0x0
     57        RenderText {#text} at (89,1) size 28x223
     58          text run at (89,1) width 223: "\x{2016}\x{2018}\x{2019}\x{2020}\x{2021}\x{2030}\x{2031}"
     59        RenderBR {BR} at (94,223) size 0x1
     60        RenderText {#text} at (117,1) size 28x293
     61          text run at (117,1) width 293: "\x{203B}\x{203C}\x{203D}\x{2042}\x{2044}\x{2047}\x{2048}\x{2049}\x{2051}"
     62        RenderBR {BR} at (122,293) size 0x1
     63        RenderText {#text} at (149,1) size 28x403
     64          text run at (149,1) width 403: "\x{2100}\x{2101}\x{2116}\x{2117}\x{2119}\x{211A}\x{2130}\x{2131}\x{2133}\x{2134}\x{213E}\x{213F}"
     65        RenderBR {BR} at (154,403) size 0x1
     66        RenderText {#text} at (187,1) size 28x170
     67          text run at (187,1) width 170: "\x{2145}\x{2146}\x{2149}\x{214A}\x{214D}"
     68        RenderBR {BR} at (192,170) size 0x1
     69        RenderText {#text} at (225,1) size 28x493
     70          text run at (225,1) width 262: "\x{2300}\x{2307}\x{230C}\x{231F}\x{2322}\x{232B}\x{237D}\x{239A} "
     71          text run at (225,262) width 231: "\x{23B4}\x{23B6}\x{23BA}\x{23CF}\x{23D1}\x{23DB}\x{23E2}\x{24FF}"
     72        RenderBR {BR} at (239,493) size 0x1
     73        RenderText {#text} at (261,1) size 28x320
     74          text run at (261,1) width 320: "\x{25A0}\x{2619}\x{2620}\x{2767}\x{2776}\x{2793}\x{2B12}\x{2B2F}\x{2E80}\x{2007}"
     75        RenderBR {BR} at (275,320) size 0x1
     76        RenderText {#text} at (297,1) size 28x350
     77          text run at (297,1) width 350: "\x{3012}\x{3013}\x{3020}\x{302F}\x{3031}\x{309F}\x{30A1}\x{30FB}\x{30FD}"
     78        RenderBR {BR} at (311,351) size 0x0
     79        RenderText {#text} at (333,1) size 28x312
     80          text run at (333,1) width 312: "\x{FE10}\x{FE30}\x{FE48}\x{FE50}\x{FE57}\x{FE5F}\x{FE62}\x{FE6}"
     81        RenderBR {BR} at (347,313) size 0x0
     82        RenderText {#text} at (369,1) size 28x390
     83          text run at (369,1) width 390: "\x{FF01}\x{FF07}\x{FF0A}\x{FF0C}\x{FF0E}\x{FF19}\x{FF1F}\x{FF3A}\x{FF3C}\x{FF3E}"
     84        RenderBR {BR} at (383,391) size 0x0
     85        RenderText {#text} at (405,1) size 28x334
     86          text run at (405,1) width 334: "\x{FF40}\x{FF5A}\x{FFE0}\x{FFE2}\x{FFE4}\x{FFFD}\x{D834}\x{DF00}\x{D83D}\x{DE4F}\x{D83D}\x{DE80}"
     87        RenderBR {BR} at (419,334) size 0x1
  • trunk/Source/WebCore/ChangeLog

    r145849 r145854  
     12013-03-14  Enrica Casucci  <enrica@apple.com>
     2
     3        Character orientation should follow UTR50 specs for vertical layout.
     4        https://bugs.webkit.org/show_bug.cgi?id=112213
     5        <rdar://problem/12880943>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        platform/mac/fast/text/vertical-no-sideways.html: Modified to cover samples
     10        of the additional character ranges that should not be rotated in vertical layout.
     11        Added pixel results.
     12
     13        This patch modifies shouldIgnoreRotation to include all the characters that
     14        should not be rotated sideways in vertical layout according to the UTR50 draft 6
     15        specifications. It also fixes rotation for Emojii.
     16
     17        * platform/graphics/FontFastPath.cpp:
     18        (WebCore::shouldIgnoreRotation):
     19        (WebCore::isInRange): Added.
     20        * platform/graphics/mac/FontMac.mm:
     21        (WebCore::showGlyphsWithAdvances): Adds the proper transforms to ensure
     22        Emojii also are drawn correctly upright.
     23
    1242013-03-14  Manuel Rego Casasnovas  <rego@igalia.com>
    225
  • trunk/Source/WebCore/platform/graphics/FontFastPath.cpp

    r138986 r145854  
    4343namespace WebCore {
    4444
     45static inline bool isInRange(UChar32 character, UChar32 lowerBound, UChar32 upperBound)
     46{
     47    return character >= lowerBound && character <= upperBound;
     48}
     49
    4550static bool shouldIgnoreRotation(UChar32 character)
    4651{
    47     switch (character) {
    48     case 0x02018:
    49     case 0x02019:
    50     case 0x000A7:
    51     case 0x000A9:
    52     case 0x000AE:
    53     case 0x000B6:
    54     case 0x000BC:
    55     case 0x000BD:
    56     case 0x000BE:
    57     case 0x002E5:
    58     case 0x002E6:
    59     case 0x002E7:
    60     case 0x002E8:
    61     case 0x002E9:
    62     case 0x02044:
    63     case 0x0210F:
    64     case 0x02122:
    65     case 0x02126:
    66     case 0x02127:
    67     case 0x0212E:
    68     case 0x02135:
    69     case 0x02153:
    70     case 0x02154:
    71     case 0x02155:
    72     case 0x0215B:
    73     case 0x0215C:
    74     case 0x0215D:
    75     case 0x0215E:
    76     case 0x02305:
    77     case 0x02306:
    78     case 0x02318:
    79     case 0x025CA:
     52    if (character == 0x000A7 || character == 0x000A9 || character == 0x000AE)
     53        return true;
     54
     55    if (character == 0x000B6 || character == 0x000BC || character == 0x000BD || character == 0x000BE)
     56        return true;
     57
     58    if (isInRange(character, 0x002E5, 0x002EB))
    8059        return true;
    8160   
    82     default:
    83         return false;
    84     }
    85 }
    86 
     61    if (isInRange(character, 0x01100, 0x011FF) || isInRange(character, 0x01401, 0x0167F) || isInRange(character, 0x01800, 0x018FF))
     62        return true;
     63
     64    if (character == 0x02016 || character == 0x02018 || character == 0x02019 || character == 0x02020 || character == 0x02021
     65        || character == 0x2030 || character == 0x02031)
     66        return true;
     67
     68    if (isInRange(character, 0x0203B, 0x0203D) || character == 0x02042 || character == 0x02044 || character == 0x02047
     69        || character == 0x02048 || character == 0x02049 || character == 0x2051)
     70        return true;
     71
     72    if (isInRange(character, 0x02065, 0x02069) || isInRange(character, 0x020DD, 0x020E0)
     73        || isInRange(character, 0x020E2, 0x020E4) || isInRange(character, 0x02100, 0x02117)
     74        || isInRange(character, 0x02119, 0x02131) || isInRange(character, 0x02133, 0x0213F))
     75        return true;
     76
     77    if (isInRange(character, 0x02145, 0x0214A) || character == 0x0214C || character == 0x0214D
     78        || isInRange(character, 0x0214F, 0x0218F))
     79        return true;
     80
     81    if (isInRange(character, 0x02300, 0x02307) || isInRange(character, 0x0230C, 0x0231F)
     82        || isInRange(character, 0x02322, 0x0232B) || isInRange(character, 0x0237D, 0x0239A)
     83        || isInRange(character, 0x023B4, 0x023B6) || isInRange(character, 0x023BA, 0x023CF)
     84        || isInRange(character, 0x023D1, 0x023DB) || isInRange(character, 0x023E2, 0x024FF))
     85        return true;
     86
     87    if (isInRange(character, 0x025A0, 0x02619) || isInRange(character, 0x02620, 0x02767)
     88        || isInRange(character, 0x02776, 0x02793) || isInRange(character, 0x02B12, 0x02B2F)
     89        || isInRange(character, 0x02B4D, 0x02BFF) || isInRange(character, 0x02E80, 0x03007))
     90        return true;
     91
     92    if (character == 0x03012 || character == 0x03013 || isInRange(character, 0x03020, 0x0302F)
     93        || isInRange(character, 0x03031, 0x0309F) || isInRange(character, 0x030A1, 0x030FB)
     94        || isInRange(character, 0x030FD, 0x0A4CF))
     95        return true;
     96
     97    if (isInRange(character, 0x0A840, 0x0A87F) || isInRange(character, 0x0A960, 0x0A97F)
     98        || isInRange(character, 0x0AC00, 0x0D7FF) || isInRange(character, 0x0E000, 0x0FAFF))
     99        return true;
     100
     101    if (isInRange(character, 0x0FE10, 0x0FE1F) || isInRange(character, 0x0FE30, 0x0FE48)
     102        || isInRange(character, 0x0FE50, 0x0FE57) || isInRange(character, 0x0FE5F, 0x0FE62)
     103        || isInRange(character, 0x0FE67, 0x0FE6F))
     104        return true;
     105
     106    if (isInRange(character, 0x0FF01, 0x0FF07) || isInRange(character, 0x0FF0A, 0x0FF0C)
     107        || isInRange(character, 0x0FF0E, 0x0FF19) ||isInRange (character, 0x0FF1F, 0x0FF3A))
     108        return true;
     109
     110    if (character == 0x0FF3C || character == 0x0FF3E)
     111        return true;
     112
     113    if (isInRange(character, 0x0FF40, 0x0FF5A) || isInRange(character, 0x0FFE0, 0x0FFE2)
     114        || isInRange(character, 0x0FFE4, 0x0FFE7) || isInRange(character, 0x0FFF0, 0x0FFF8)
     115        || character == 0x0FFFD)
     116        return true;
     117
     118    if (isInRange(character, 0x13000, 0x1342F) || isInRange(character, 0x1B000, 0x1B0FF)
     119        || isInRange(character, 0x1D000, 0x1D1FF) || isInRange(character, 0x1D300, 0x1D37F)
     120        || isInRange(character, 0x1F000, 0x1F64F) || isInRange(character, 0x1F680, 0x1F77F))
     121        return true;
     122   
     123    if (isInRange(character, 0x20000, 0x2FFFD) || isInRange(character, 0x30000, 0x3FFFD))
     124        return true;
     125
     126    return false;
     127}
     128   
    87129static inline std::pair<GlyphData, GlyphPage*> glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, GlyphData& data, GlyphPage* page, unsigned pageNumber)
    88130{
  • trunk/Source/WebCore/platform/graphics/mac/FontMac.mm

    r134755 r145854  
    8181static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
    8282{
     83    if (!count)
     84        return;
     85
    8386    CGContextSetTextPosition(context, point.x(), point.y());
    8487
    8588    const FontPlatformData& platformData = font->platformData();
    86     if (!platformData.isColorBitmapFont()) {
    87         CGAffineTransform savedMatrix;
    88         bool isVertical = font->platformData().orientation() == Vertical;
    89         if (isVertical) {
    90             CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0);
    91             savedMatrix = CGContextGetTextMatrix(context);
    92             CGAffineTransform runMatrix = CGAffineTransformConcat(savedMatrix, rotateLeftTransform);
    93             CGContextSetTextMatrix(context, runMatrix);
    94            
    95             CGAffineTransform translationsTransform;
    96             if (hasBrokenCTFontGetVerticalTranslationsForGlyphs()) {
    97                 translationsTransform = CGAffineTransformMake(platformData.m_size, 0, 0, platformData.m_size, 0, 0);
    98                 translationsTransform = CGAffineTransformConcat(translationsTransform, rotateLeftTransform);
    99                 CGFloat unitsPerEm = CGFontGetUnitsPerEm(platformData.cgFont());
    100                 translationsTransform = CGAffineTransformConcat(translationsTransform, CGAffineTransformMakeScale(1 / unitsPerEm, 1 / unitsPerEm));
    101             } else {
    102                 translationsTransform = rotateLeftTransform;
    103             }
    104             Vector<CGSize, 256> translations(count);
    105             CTFontGetVerticalTranslationsForGlyphs(platformData.ctFont(), glyphs, translations.data(), count);
    106            
    107             CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context));
    108 
    109             CGPoint position = FloatPoint(point.x(), point.y() + font->fontMetrics().floatAscent(IdeographicBaseline) - font->fontMetrics().floatAscent());
    110             Vector<CGPoint, 256> positions(count);
    111             for (size_t i = 0; i < count; ++i) {
    112                 CGSize translation = CGSizeApplyAffineTransform(translations[i], translationsTransform);
    113                 positions[i] = CGPointApplyAffineTransform(CGPointMake(position.x - translation.width, position.y + translation.height), transform);
    114                 position.x += advances[i].width;
    115                 position.y += advances[i].height;
    116             }
    117             CGContextShowGlyphsAtPositions(context, glyphs, positions.data(), count);
    118             CGContextSetTextMatrix(context, savedMatrix);
    119         } else {
    120 #pragma clang diagnostic push
    121 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
    122             CGContextShowGlyphsWithAdvances(context, glyphs, advances, count);
    123 #pragma clang diagnostic pop
    124         }
    125     }
    126 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    127     else {
    128         if (!count)
    129             return;
    130 
    131         Vector<CGPoint, 256> positions(count);
     89    Vector<CGPoint, 256> positions(count);
     90    if (platformData.isColorBitmapFont()) {
    13291        CGAffineTransform matrix = CGAffineTransformInvert(CGContextGetTextMatrix(context));
    13392        positions[0] = CGPointZero;
     
    13796            positions[i].y = positions[i - 1].y + advance.height;
    13897        }
    139         CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
    140     }
    141 #endif
     98    }
     99    bool isVertical = font->platformData().orientation() == Vertical;
     100    if (isVertical) {
     101        CGAffineTransform savedMatrix;
     102        CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0);
     103        savedMatrix = CGContextGetTextMatrix(context);
     104        CGAffineTransform runMatrix = CGAffineTransformConcat(savedMatrix, rotateLeftTransform);
     105        CGContextSetTextMatrix(context, runMatrix);
     106
     107        CGAffineTransform translationsTransform;
     108        if (hasBrokenCTFontGetVerticalTranslationsForGlyphs()) {
     109            translationsTransform = CGAffineTransformMake(platformData.m_size, 0, 0, platformData.m_size, 0, 0);
     110            translationsTransform = CGAffineTransformConcat(translationsTransform, rotateLeftTransform);
     111            CGFloat unitsPerEm = CGFontGetUnitsPerEm(platformData.cgFont());
     112            translationsTransform = CGAffineTransformConcat(translationsTransform, CGAffineTransformMakeScale(1 / unitsPerEm, 1 / unitsPerEm));
     113        } else
     114            translationsTransform = rotateLeftTransform;
     115
     116        Vector<CGSize, 256> translations(count);
     117        CTFontGetVerticalTranslationsForGlyphs(platformData.ctFont(), glyphs, translations.data(), count);
     118
     119        CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context));
     120
     121        CGPoint position = FloatPoint(point.x(), point.y() + font->fontMetrics().floatAscent(IdeographicBaseline) - font->fontMetrics().floatAscent());
     122        for (size_t i = 0; i < count; ++i) {
     123            CGSize translation = CGSizeApplyAffineTransform(translations[i], translationsTransform);
     124            positions[i] = CGPointApplyAffineTransform(CGPointMake(position.x - translation.width, position.y + translation.height), transform);
     125            position.x += advances[i].width;
     126            position.y += advances[i].height;
     127        }
     128        if (!platformData.isColorBitmapFont())
     129            CGContextShowGlyphsAtPositions(context, glyphs, positions.data(), count);
     130#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     131        else
     132            CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
     133#endif
     134        CGContextSetTextMatrix(context, savedMatrix);
     135    } else {
     136        if (!platformData.isColorBitmapFont())
     137#pragma clang diagnostic push
     138#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     139            CGContextShowGlyphsWithAdvances(context, glyphs, advances, count);
     140#pragma clang diagnostic pop
     141#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     142        else
     143            CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
     144#endif
     145    }
    142146}
    143147
Note: See TracChangeset for help on using the changeset viewer.