Title: [96404] trunk
Revision
96404
Author
m...@apple.com
Date
2011-09-30 10:05:22 -0700 (Fri, 30 Sep 2011)

Log Message

Complex spaces with synthetic bold are too wide
https://bugs.webkit.org/show_bug.cgi?id=69033

Patch by Ned Holbrook <nholbr...@apple.com> on 2011-09-30
Reviewed by Dan Bernstein.

Source/WebCore: 

Test: fast/text/complex-synthetic-bold-space-width.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Subtract synthetic bold offset from spaceWidth.
* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::shapeAndPlaceItem): Ditto.

LayoutTests: 

* fast/text/complex-synthetic-bold-space-width.html: Added.
* platform/mac/fast/text/atsui-multiple-renderers-expected.png:
* platform/mac/fast/text/atsui-multiple-renderers-expected.txt:
* platform/mac/fast/text/complex-synthetic-bold-space-width-expected.png: Added.
* platform/mac/fast/text/complex-synthetic-bold-space-width-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96403 => 96404)


--- trunk/LayoutTests/ChangeLog	2011-09-30 17:00:10 UTC (rev 96403)
+++ trunk/LayoutTests/ChangeLog	2011-09-30 17:05:22 UTC (rev 96404)
@@ -1,3 +1,16 @@
+2011-09-30  Ned Holbrook  <nholbr...@apple.com>
+
+        Complex spaces with synthetic bold are too wide
+        https://bugs.webkit.org/show_bug.cgi?id=69033
+
+        Reviewed by Dan Bernstein.
+
+        * fast/text/complex-synthetic-bold-space-width.html: Added.
+        * platform/mac/fast/text/atsui-multiple-renderers-expected.png:
+        * platform/mac/fast/text/atsui-multiple-renderers-expected.txt:
+        * platform/mac/fast/text/complex-synthetic-bold-space-width-expected.png: Added.
+        * platform/mac/fast/text/complex-synthetic-bold-space-width-expected.txt: Added.
+
 2011-09-30  Antaryami Pandia  <antaryami.pan...@motorola.com>
 
         LayoutTests: Rewrite fast/dom/HTMLInputElement/input-size-attribute.html

Added: trunk/LayoutTests/fast/text/complex-synthetic-bold-space-width.html (0 => 96404)


--- trunk/LayoutTests/fast/text/complex-synthetic-bold-space-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/complex-synthetic-bold-space-width.html	2011-09-30 17:05:22 UTC (rev 96404)
@@ -0,0 +1,2 @@
+These lines should have the same width:
+<div style="font-family: geneva; font-weight: bold;">. . . . . . . . a<br>. . . . . . . . a&#x0300</div>

Modified: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt (96403 => 96404)


--- trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt	2011-09-30 17:00:10 UTC (rev 96403)
+++ trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt	2011-09-30 17:05:22 UTC (rev 96404)
@@ -35,11 +35,11 @@
               RenderText {#text} at (0,0) size 0x0
           RenderTableRow {TR} at (0,30) size 262x30
             RenderTableCell {TD} at (0,30) size 131x30 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
-              RenderText {#text} at (2,3) size 76x25
-                text run at (2,3) width 76: "Lore\x{300}m "
+              RenderText {#text} at (2,3) size 75x25
+                text run at (2,3) width 75: "Lore\x{300}m "
               RenderInline {SPAN} at (0,0) size 53x23
-                RenderText {#text} at (78,5) size 53x23
-                  text run at (78,5) width 53: "ipsu\x{308}m"
+                RenderText {#text} at (77,5) size 53x23
+                  text run at (77,5) width 53: "ipsu\x{308}m"
               RenderText {#text} at (0,0) size 0x0
             RenderTableCell {TD} at (131,30) size 131x30 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
               RenderText {#text} at (2,3) size 75x25
@@ -65,11 +65,11 @@
               RenderText {#text} at (0,0) size 0x0
           RenderTableRow {TR} at (0,90) size 262x30
             RenderTableCell {TD} at (0,90) size 131x30 [border: (1px solid #008000)] [r=3 c=0 rs=1 cs=1]
-              RenderText {#text} at (2,3) size 76x25
-                text run at (2,3) width 76: "Lore\x{300}m "
+              RenderText {#text} at (2,3) size 75x25
+                text run at (2,3) width 75: "Lore\x{300}m "
               RenderInline {SPAN} at (0,0) size 51x23
-                RenderText {#text} at (78,5) size 51x23
-                  text run at (78,5) width 51: "ipsu\x{308}m"
+                RenderText {#text} at (77,5) size 51x23
+                  text run at (77,5) width 51: "ipsu\x{308}m"
               RenderText {#text} at (0,0) size 0x0
             RenderTableCell {TD} at (131,90) size 131x30 [border: (1px solid #008000)] [r=3 c=1 rs=1 cs=1]
               RenderText {#text} at (2,3) size 75x25

Added: trunk/LayoutTests/platform/mac/fast/text/complex-synthetic-bold-space-width-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/text/complex-synthetic-bold-space-width-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/text/complex-synthetic-bold-space-width-expected.txt (0 => 96404)


--- trunk/LayoutTests/platform/mac/fast/text/complex-synthetic-bold-space-width-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/complex-synthetic-bold-space-width-expected.txt	2011-09-30 17:05:22 UTC (rev 96404)
@@ -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 (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 254x18
+          text run at (0,0) width 254: "These lines should have the same width:"
+      RenderBlock {DIV} at (0,18) size 784x42
+        RenderText {#text} at (0,0) size 106x20
+          text run at (0,0) width 106: ". . . . . . . . a"
+        RenderBR {BR} at (106,16) size 0x0
+        RenderText {#text} at (0,21) size 106x20
+          text run at (0,21) width 106: ". . . . . . . . a\x{300}"

Modified: trunk/Source/WebCore/ChangeLog (96403 => 96404)


--- trunk/Source/WebCore/ChangeLog	2011-09-30 17:00:10 UTC (rev 96403)
+++ trunk/Source/WebCore/ChangeLog	2011-09-30 17:05:22 UTC (rev 96404)
@@ -1,3 +1,17 @@
+2011-09-30  Ned Holbrook  <nholbr...@apple.com>
+
+        Complex spaces with synthetic bold are too wide
+        https://bugs.webkit.org/show_bug.cgi?id=69033
+
+        Reviewed by Dan Bernstein.
+
+        Test: fast/text/complex-synthetic-bold-space-width.html
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Subtract synthetic bold offset from spaceWidth.
+        * platform/graphics/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::shapeAndPlaceItem): Ditto.
+
 2011-09-30  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: [chromium] expose inspector protocol version to the embedder.

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (96403 => 96404)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2011-09-30 17:00:10 UTC (rev 96403)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2011-09-30 17:05:22 UTC (rev 96404)
@@ -477,7 +477,8 @@
 
         bool lastRun = r + 1 == runCount;
         bool roundsAdvances = !m_font.isPrinterFont() && fontData->platformData().roundsGlyphAdvances();
-        CGFloat roundedSpaceWidth = roundCGFloat(fontData->spaceWidth());
+        float spaceWidth = fontData->spaceWidth() - fontData->syntheticBoldOffset();
+        CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth);
         const UChar* cp = complexTextRun.characters();
         CGPoint glyphOrigin = CGPointZero;
         CFIndex lastCharacterIndex = m_run.ltr() ? numeric_limits<CFIndex>::min() : numeric_limits<CFIndex>::max();
@@ -504,7 +505,7 @@
 
             bool treatAsSpace = Font::treatAsSpace(ch);
             CGGlyph glyph = treatAsSpace ? fontData->spaceGlyph() : glyphs[i];
-            CGSize advance = treatAsSpace ? CGSizeMake(fontData->spaceWidth(), advances[i].height) : advances[i];
+            CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
 
             if (ch == '\t' && m_run.allowTabs()) {
                 float tabWidth = m_font.tabWidth(*fontData);

Modified: trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp (96403 => 96404)


--- trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2011-09-30 17:00:10 UTC (rev 96403)
+++ trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2011-09-30 17:05:22 UTC (rev 96404)
@@ -266,8 +266,8 @@
     spaceCharacters.fill(-1);
 
     const float cLogicalScale = fontData->platformData().useGDI() ? 1.0f : 32.0f;
-    unsigned logicalSpaceWidth = fontData->spaceWidth() * cLogicalScale;
-    float spaceWidth = fontData->spaceWidth();
+    float spaceWidth = fontData->spaceWidth() - fontData->syntheticBoldOffset();
+    unsigned logicalSpaceWidth = spaceWidth * cLogicalScale;
 
     for (int k = 0; k < len; k++) {
         UChar ch = *(str + k);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to