Kerning never occurs between a space and the following glyph
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2012 23:19:43 +0000 (23:19 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2012 23:19:43 +0000 (23:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97269

Reviewed by Tim Horton.

Source/WebCore:

Covered by several existing tests.

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Changed to not reset the advance
of a space, and added a comment about how this also needs to be fixed for other characters
that are treated as spaces.

LayoutTests:

* platform/mac/fast/text/emphasis-expected.png:
* platform/mac/fast/text/emphasis-expected.txt:
* platform/mac/fast/text/sticky-typesetting-features-expected.png:
* platform/mac/fast/text/sticky-typesetting-features-expected.txt:
* platform/mac/fast/text/thai-combining-mark-positioning-expected.png:
* platform/mac/fast/text/thai-combining-mark-positioning-expected.txt:
* platform/mac/fast/writing-mode/text-orientation-basic-expected.png:
* platform/mac/fast/writing-mode/text-orientation-basic-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/text/emphasis-expected.png
LayoutTests/platform/mac/fast/text/emphasis-expected.txt
LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.png
LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.txt
LayoutTests/platform/mac/fast/text/thai-combining-mark-positioning-expected.png
LayoutTests/platform/mac/fast/text/thai-combining-mark-positioning-expected.txt
LayoutTests/platform/mac/fast/writing-mode/text-orientation-basic-expected.png
LayoutTests/platform/mac/fast/writing-mode/text-orientation-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

index 6117be3..b61cc67 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-20  Dan Bernstein  <mitz@apple.com>
+
+        Kerning never occurs between a space and the following glyph
+        https://bugs.webkit.org/show_bug.cgi?id=97269
+
+        Reviewed by Tim Horton.
+
+        * platform/mac/fast/text/emphasis-expected.png:
+        * platform/mac/fast/text/emphasis-expected.txt:
+        * platform/mac/fast/text/sticky-typesetting-features-expected.png:
+        * platform/mac/fast/text/sticky-typesetting-features-expected.txt:
+        * platform/mac/fast/text/thai-combining-mark-positioning-expected.png:
+        * platform/mac/fast/text/thai-combining-mark-positioning-expected.txt:
+        * platform/mac/fast/writing-mode/text-orientation-basic-expected.png:
+        * platform/mac/fast/writing-mode/text-orientation-basic-expected.txt:
+
 2012-09-20  Kenichi Ishibashi  <bashi@chromium.org>
 
         [Chromium] Improve glyph selection of HarfBuzzShaper
index 879ab26..40a0e94 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/text/emphasis-expected.png and b/LayoutTests/platform/mac/fast/text/emphasis-expected.png differ
index f7adaf8..7844228 100644 (file)
@@ -25,9 +25,9 @@ layer at (0,0) size 800x562
         RenderInline {SPAN} at (0,0) size 217x28
           RenderText {#text} at (3,45) size 217x28
             text run at (3,45) width 217: "consectetur adipiscing"
-        RenderText {#text} at (220,45) size 135x28
+        RenderText {#text} at (220,45) size 134x28
           text run at (220,45) width 6: " "
-          text run at (226,45) width 129: "elit. Aliquam"
+          text run at (226,45) width 128: "elit. Aliquam"
         RenderInline {SPAN} at (0,0) size 111x28
           RenderText {#text} at (3,73) size 111x28
             text run at (3,73) width 111: "odio sa\x{300}pien"
index 17c48e0..ff24610 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.png and b/LayoutTests/platform/mac/fast/text/sticky-typesetting-features-expected.png differ
index 5a406a4..3a1b8aa 100644 (file)
@@ -13,5 +13,5 @@ layer at (0,0) size 800x600
         RenderText {#text} at (0,0) size 324x18
           text run at (0,0) width 324: "This should be rendered with kerning and ligatures:"
       RenderBlock {DIV} at (0,250) size 784x166
-        RenderText {#text} at (0,0) size 754x166
-          text run at (0,0) width 754: "Office Today"
+        RenderText {#text} at (0,0) size 751x166
+          text run at (0,0) width 751: "Office Today"
index 9dd966c..aca6db0 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/text/thai-combining-mark-positioning-expected.png and b/LayoutTests/platform/mac/fast/text/thai-combining-mark-positioning-expected.png differ
index 94156ea..a114f89 100644 (file)
@@ -4,5 +4,5 @@ layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {DIV} at (0,0) size 784x101
-        RenderText {#text} at (0,0) size 384x101
-          text run at (0,0) width 384: "\x{E43}\x{E2B}\x{E49}\x{E21}\x{E35}\x{E02}\x{E36}\x{E49}\x{E19} \x{E01}\x{E32}\x{E23}\x{E17}\x{E4D}\x{E32}\x{E43}\x{E2B}\x{E49}"
+        RenderText {#text} at (0,0) size 385x101
+          text run at (0,0) width 385: "\x{E43}\x{E2B}\x{E49}\x{E21}\x{E35}\x{E02}\x{E36}\x{E49}\x{E19} \x{E01}\x{E32}\x{E23}\x{E17}\x{E4D}\x{E32}\x{E43}\x{E2B}\x{E49}"
index 5936c77..d37655a 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/writing-mode/text-orientation-basic-expected.png and b/LayoutTests/platform/mac/fast/writing-mode/text-orientation-basic-expected.png differ
index b10705d..22aa99d 100644 (file)
@@ -49,8 +49,8 @@ layer at (0,0) size 785x704
             RenderText {#text} at (94,1) size 36x197
               text run at (94,1) width 197: "Hello world"
           RenderBR {BR} at (112,198) size 0x0
-          RenderInline {SPAN} at (0,0) size 36x221
-            RenderText {#text} at (148,1) size 36x221
-              text run at (148,1) width 221: "Hello world"
-          RenderBR {BR} at (166,222) size 0x0
+          RenderInline {SPAN} at (0,0) size 36x197
+            RenderText {#text} at (148,1) size 36x197
+              text run at (148,1) width 197: "Hello world"
+          RenderBR {BR} at (166,198) size 0x0
         RenderText {#text} at (0,0) size 0x0
index 8500520..226e7f8 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-20  Dan Bernstein  <mitz@apple.com>
+
+        Kerning never occurs between a space and the following glyph
+        https://bugs.webkit.org/show_bug.cgi?id=97269
+
+        Reviewed by Tim Horton.
+
+        Covered by several existing tests.
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Changed to not reset the advance
+        of a space, and added a comment about how this also needs to be fixed for other characters
+        that are treated as spaces.
+
 2012-09-20  Kenichi Ishibashi  <bashi@chromium.org>
 
         [Chromium] Improve glyph selection of HarfBuzzShaper
index 7188c88..876c54f 100644 (file)
@@ -580,8 +580,14 @@ void ComplexTextController::adjustGlyphsAndAdvances()
                 nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0));
 
             bool treatAsSpace = Font::treatAsSpace(ch);
-            CGGlyph glyph = treatAsSpace ? fontData->spaceGlyph() : glyphs[i];
-            CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
+            CGGlyph glyph = glyphs[i];
+            CGSize advance = advances[i];
+            // FIXME: We should find a way to substitute spaces for characters that are treated as spaces
+            // before handing them off to Core Text, so that kerning can be applied as if they were spaces.
+            if (treatAsSpace && ch != ' ') {
+                glyph = fontData->spaceGlyph();
+                advance.width = spaceWidth;
+            }
 
             if (ch == '\t' && m_run.allowTabs())
                 advance.width = m_font.tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);