Title: [190891] trunk
Revision
190891
Author
mmaxfi...@apple.com
Date
2015-10-12 15:08:27 -0700 (Mon, 12 Oct 2015)

Log Message

REGRESSION(r182192): Ligatures do not interact correctly with SHY in some fonts
https://bugs.webkit.org/show_bug.cgi?id=150006

Reviewed by Simon Fraser.

Source/WebCore:

When performing font transforms and we encounter kCGFontIndexInvalid, we filter it out of the
GlyphBuffer. However, this filter was only interacting with part of the GlyphBuffer instead
of the whole thing. This causes glyph IDs from one font to be rendered with other fonts,
thereby showing garbage glyphs.

However, now that <rdar://problem/20230073> is fixed, we don't need to perform this filter in
the first place.

Test: fast/text/undefined-glyph-with-ligature.html

* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::copyItem):
(WebCore::GlyphBuffer::swap):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):

LayoutTests:

* fast/text/resources/tiny-ligature-font.svg: Added.
* fast/text/undefined-glyph-with-ligature-expected.html: Added.
* fast/text/undefined-glyph-with-ligature.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (190890 => 190891)


--- trunk/LayoutTests/ChangeLog	2015-10-12 21:48:32 UTC (rev 190890)
+++ trunk/LayoutTests/ChangeLog	2015-10-12 22:08:27 UTC (rev 190891)
@@ -1,3 +1,14 @@
+2015-10-12  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        REGRESSION(r182192): Ligatures do not interact correctly with SHY in some fonts
+        https://bugs.webkit.org/show_bug.cgi?id=150006
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/resources/tiny-ligature-font.svg: Added.
+        * fast/text/undefined-glyph-with-ligature-expected.html: Added.
+        * fast/text/undefined-glyph-with-ligature.html: Added.
+
 2015-10-12  Antoine Quint  <grao...@apple.com>
 
         [SVG] Handle endEvent for svg animations

Added: trunk/LayoutTests/fast/text/resources/tiny-ligature-font.svg (0 => 190891)


--- trunk/LayoutTests/fast/text/resources/tiny-ligature-font.svg	                        (rev 0)
+++ trunk/LayoutTests/fast/text/resources/tiny-ligature-font.svg	2015-10-12 22:08:27 UTC (rev 190891)
@@ -0,0 +1,13 @@
+<?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="1000">
+      <font-face units-per-em="1000" ascent="1000" descent="0">
+      </font-face>
+    <glyph unicode="A" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 H 500 z"/>
+    <glyph unicode="B" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 H 500 z"/>
+    <glyph unicode="AB" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 H 500 z"/>
+    <glyph unicode=" B" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 H 500 z"/>
+    </font>
+  </defs>
+</svg>

Added: trunk/LayoutTests/fast/text/undefined-glyph-with-ligature-expected.html (0 => 190891)


--- trunk/LayoutTests/fast/text/undefined-glyph-with-ligature-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/undefined-glyph-with-ligature-expected.html	2015-10-12 22:08:27 UTC (rev 190891)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: Litherum;
+    src: url("resources/tiny-ligature-font.svg") format("svg");
+}
+</style>
+</head>
+<body>
+This test makes sure that the combination of ligatures and nonexistant glyphs do not cause arbitrary glyphs to be rendered.
+The test passes if you see two black rectangles below, and nothing else.
+<div style="font-family: Litherum;">ABA</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/undefined-glyph-with-ligature.html (0 => 190891)


--- trunk/LayoutTests/fast/text/undefined-glyph-with-ligature.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/undefined-glyph-with-ligature.html	2015-10-12 22:08:27 UTC (rev 190891)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: Litherum;
+    src: url("resources/tiny-ligature-font.svg") format("svg");
+}
+</style>
+</head>
+<body>
+This test makes sure that the combination of ligatures and nonexistant glyphs do not cause arbitrary glyphs to be rendered.
+The test passes if you see two black rectangles below, and nothing else.
+<div style="font-family: Litherum;">AB&shy;A</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (190890 => 190891)


--- trunk/Source/WebCore/ChangeLog	2015-10-12 21:48:32 UTC (rev 190890)
+++ trunk/Source/WebCore/ChangeLog	2015-10-12 22:08:27 UTC (rev 190891)
@@ -1,3 +1,26 @@
+2015-10-12  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        REGRESSION(r182192): Ligatures do not interact correctly with SHY in some fonts
+        https://bugs.webkit.org/show_bug.cgi?id=150006
+
+        Reviewed by Simon Fraser.
+
+        When performing font transforms and we encounter kCGFontIndexInvalid, we filter it out of the
+        GlyphBuffer. However, this filter was only interacting with part of the GlyphBuffer instead
+        of the whole thing. This causes glyph IDs from one font to be rendered with other fonts,
+        thereby showing garbage glyphs.
+
+        However, now that <rdar://problem/20230073> is fixed, we don't need to perform this filter in
+        the first place.
+
+        Test: fast/text/undefined-glyph-with-ligature.html
+
+        * platform/graphics/GlyphBuffer.h:
+        (WebCore::GlyphBuffer::copyItem):
+        (WebCore::GlyphBuffer::swap):
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::applyFontTransforms):
+
 2015-10-12  Antoine Quint  <grao...@apple.com>
 
         [SVG] Handle endEvent for svg animations

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (190890 => 190891)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-10-12 21:48:32 UTC (rev 190890)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2015-10-12 22:08:27 UTC (rev 190891)
@@ -155,19 +155,6 @@
     }
     charactersTreatedAsSpace.clear();
 
-#if PLATFORM(MAC) || PLATFORM(IOS)
-    // Workaround for <rdar://problem/20230073> FIXME: Please remove this when no longer needed.
-    GlyphBufferGlyph* glyphs = glyphBuffer->glyphs(0);
-    int filteredIndex = lastGlyphCount;
-    for (int i = lastGlyphCount; i < glyphBufferSize; ++i) {
-        glyphs[filteredIndex] = glyphs[i];
-        advances[filteredIndex] = advances[i];
-        if (glyphs[filteredIndex] != kCGFontIndexInvalid)
-            ++filteredIndex;
-    }
-    glyphBufferSize = filteredIndex;
-#endif
-
     for (int i = lastGlyphCount; i < glyphBufferSize; ++i)
         widthDifference += advances[i].width();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to