Title: [192639] trunk
Revision
192639
Author
mmaxfi...@apple.com
Date
2015-11-19 11:16:31 -0800 (Thu, 19 Nov 2015)

Log Message

Tatechuyoko in ruby sits too high
https://bugs.webkit.org/show_bug.cgi?id=151309
<rdar://problem/23536621>

Reviewed by Darin Adler.

Source/WebCore:

When combining text, we ask what the text's width is in order to determine if it fits in the
column. However, when we do that, we were not setting the font's orientation to horizontal.
This means that, for CJK text, the "width" which was returned was actually the height of the
glyph, and the GlyphOverflow data was similarly garbled.

We actually already were creating a corrected FontDescription, and using it in two places.
However, we weren't using it in the last place, which was causing this bug.

Test: fast/text/text-combine-placement.html

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::width):
* rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::combineText):

LayoutTests:

* fast/text/resources/tatechuyoko.svg: Added.
* fast/text/text-combine-placement-expected.html: Added.
* fast/text/text-combine-placement.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192638 => 192639)


--- trunk/LayoutTests/ChangeLog	2015-11-19 19:15:43 UTC (rev 192638)
+++ trunk/LayoutTests/ChangeLog	2015-11-19 19:16:31 UTC (rev 192639)
@@ -1,3 +1,15 @@
+2015-11-19  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Tatechuyoko in ruby sits too high
+        https://bugs.webkit.org/show_bug.cgi?id=151309
+        <rdar://problem/23536621>
+
+        Reviewed by Darin Adler.
+
+        * fast/text/resources/tatechuyoko.svg: Added.
+        * fast/text/text-combine-placement-expected.html: Added.
+        * fast/text/text-combine-placement.html: Added.
+
 2015-11-19  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking storage/indexeddb/modern/aborted-put.html as flaky on mac-wk1

Added: trunk/LayoutTests/fast/text/resources/tatechuyoko.svg (0 => 192639)


--- trunk/LayoutTests/fast/text/resources/tatechuyoko.svg	                        (rev 0)
+++ trunk/LayoutTests/fast/text/resources/tatechuyoko.svg	2015-11-19 19:16:31 UTC (rev 192639)
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="yes"?>
+<svg  version="1.1" viewBox="0 0 160 160" xmlns = 'http://www.w3.org/2000/svg' xmlns:xlink="http://www.w3.org/1999/xlink">
+  <defs>
+    <font id="Litherum" horiz-adv-x="1024">
+      <font-face units-per-em="1024" ascent="512" descent="512">
+      </font-face>
+    <glyph unicode="A" horiz-adv-x="256" d="m 0 0 v 128 h 128 v -128 z"/>
+    <glyph unicode="&#x306e;" horiz-adv-x="256" d="m 0 0 v 128 h 128 v -128 z"/>
+    </font>
+  </defs>
+</svg>

Added: trunk/LayoutTests/fast/text/text-combine-placement-expected.html (0 => 192639)


--- trunk/LayoutTests/fast/text/text-combine-placement-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/text-combine-placement-expected.html	2015-11-19 19:16:31 UTC (rev 192639)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "Litherum";
+    src: url("resources/tatechuyoko.svg#Litherum") format("svg");
+}
+</style>
+</head>
+<body>
+<p>This test makes sure that tatechuyoko glyphs are centered correctly within the space left for them. The test is successful if the three boxes on the left have the same vertical positions as the three boxes on the right. The two vertically-middle boxes should be vertically centered between the four corner boxes.</p>
+<p>Note that the boxes' horizontal spacing is irrelevant here. We are only interested in vertical spacing.</p>
+<div style="-webkit-writing-mode: vertical-rl;">
+<div><span style="font: 32px Ahem;">A</span><span style="font: 256px Litherum; -webkit-text-combine: horizontal;">A</span><span style="font: 32px Ahem;">A</span></div>
+<div><span style="font: 32px Ahem;">A</span><span style="font: 256px Litherum; -webkit-text-combine: horizontal;">A</span><span style="font: 32px Ahem;">A</span></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/text-combine-placement.html (0 => 192639)


--- trunk/LayoutTests/fast/text/text-combine-placement.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/text-combine-placement.html	2015-11-19 19:16:31 UTC (rev 192639)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "Litherum";
+    src: url("resources/tatechuyoko.svg#Litherum") format("svg");
+}
+</style>
+</head>
+<body>
+<p>This test makes sure that tatechuyoko glyphs are centered correctly within the space left for them. The test is successful if the three boxes on the left have the same vertical positions as the three boxes on the right. The two vertically-middle boxes should be vertically centered between the four corner boxes.</p>
+<p>Note that the boxes' horizontal spacing is irrelevant here. We are only interested in vertical spacing.</p>
+<div style="-webkit-writing-mode: vertical-rl;">
+<div><span style="font: 32px Ahem;">A</span><span style="font: 256px Litherum; -webkit-text-combine: horizontal;">A</span><span style="font: 32px Ahem;">A</span></div>
+<div><span style="font: 32px Ahem;">A</span><span style="font: 256px Litherum; -webkit-text-combine: horizontal;">&#x306e;</span><span style="font: 32px Ahem;">A</span></div>
+</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (192638 => 192639)


--- trunk/Source/WebCore/ChangeLog	2015-11-19 19:15:43 UTC (rev 192638)
+++ trunk/Source/WebCore/ChangeLog	2015-11-19 19:16:31 UTC (rev 192639)
@@ -1,3 +1,26 @@
+2015-11-19  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Tatechuyoko in ruby sits too high
+        https://bugs.webkit.org/show_bug.cgi?id=151309
+        <rdar://problem/23536621>
+
+        Reviewed by Darin Adler.
+
+        When combining text, we ask what the text's width is in order to determine if it fits in the
+        column. However, when we do that, we were not setting the font's orientation to horizontal.
+        This means that, for CJK text, the "width" which was returned was actually the height of the
+        glyph, and the GlyphOverflow data was similarly garbled.
+
+        We actually already were creating a corrected FontDescription, and using it in two places.
+        However, we weren't using it in the last place, which was causing this bug.
+
+        Test: fast/text/text-combine-placement.html
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::width):
+        * rendering/RenderCombineText.cpp:
+        (WebCore::RenderCombineText::combineText):
+
 2015-11-19  Hunseop Jeong  <hs85.je...@samsung.com>
 
         [EFL] http/tests/navigation/useragent test failed after r192459.

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (192638 => 192639)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-11-19 19:15:43 UTC (rev 192638)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-11-19 19:16:31 UTC (rev 192639)
@@ -352,10 +352,10 @@
     if (codePathToUse != Complex) {
         // The complex path is more restrictive about returning fallback fonts than the simple path, so we need an explicit test to make their behaviors match.
         if (!canReturnFallbackFontsForComplexText())
-            fallbackFonts = 0;
+            fallbackFonts = nullptr;
         // The simple path can optimize the case where glyph overflow is not observable.
         if (codePathToUse != SimpleWithGlyphOverflow && (glyphOverflow && !glyphOverflow->computeBounds))
-            glyphOverflow = 0;
+            glyphOverflow = nullptr;
     }
 
     bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing();

Modified: trunk/Source/WebCore/rendering/RenderCombineText.cpp (192638 => 192639)


--- trunk/Source/WebCore/rendering/RenderCombineText.cpp	2015-11-19 19:15:43 UTC (rev 192638)
+++ trunk/Source/WebCore/rendering/RenderCombineText.cpp	2015-11-19 19:16:31 UTC (rev 192639)
@@ -117,20 +117,22 @@
     float emWidth = description.computedSize() * textCombineMargin;
     bool shouldUpdateFont = false;
 
+    FontSelector* fontSelector = style().fontCascade().fontSelector();
+
     description.setOrientation(Horizontal); // We are going to draw combined text horizontally.
+
+    FontCascade horizontalFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
+    horizontalFont.update(fontSelector);
     
     GlyphOverflow glyphOverflow;
     glyphOverflow.computeBounds = true;
-    
-    float combinedTextWidth = width(0, textLength(), originalFont(), 0, nullptr, &glyphOverflow);
+    float combinedTextWidth = width(0, textLength(), horizontalFont, 0, nullptr, &glyphOverflow);
 
     float bestFitDelta = combinedTextWidth - emWidth;
     auto bestFitDescription = description;
 
     m_isCombined = combinedTextWidth <= emWidth;
     
-    FontSelector* fontSelector = style().fontCascade().fontSelector();
-    
     if (m_isCombined)
         shouldUpdateFont = m_combineFontStyle->setFontDescription(description); // Need to change font orientation to horizontal.
     else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to