Title: [164075] trunk
Revision
164075
Author
mmaxfi...@apple.com
Date
2014-02-13 16:30:15 -0800 (Thu, 13 Feb 2014)

Log Message

text-decoration-skip: ink skips randomly when using SVG fonts
https://bugs.webkit.org/show_bug.cgi?id=128709

Reviewed by Simon Fraser.

Source/WebCore:

This patch simply disables skipping underlines being used with SVG fonts.
It's a stopgap until we can support skipping properly with SVG fonts.

Test: svg/custom/svg-fonts-skip-ink.html

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::ctFont):
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::dashesForIntersectionsWithRect):

LayoutTests:

This text checks that some text without descenders in an SVG font renders the same with and
without text-decoration-skip: ink.

* svg/custom/svg-fonts-skip-ink-expected.html: Added.
* svg/custom/svg-fonts-skip-ink.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164074 => 164075)


--- trunk/LayoutTests/ChangeLog	2014-02-14 00:22:45 UTC (rev 164074)
+++ trunk/LayoutTests/ChangeLog	2014-02-14 00:30:15 UTC (rev 164075)
@@ -1,3 +1,16 @@
+2014-02-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        text-decoration-skip: ink skips randomly when using SVG fonts
+        https://bugs.webkit.org/show_bug.cgi?id=128709
+
+        Reviewed by Simon Fraser.
+
+        This text checks that some text without descenders in an SVG font renders the same with and
+        without text-decoration-skip: ink.
+
+        * svg/custom/svg-fonts-skip-ink-expected.html: Added.
+        * svg/custom/svg-fonts-skip-ink.html: Added.
+
 2014-02-13  Brent Fulgham  <bfulg...@apple.com>
 
         Create some latched scrolling tests.

Added: trunk/LayoutTests/svg/custom/svg-fonts-skip-ink-expected.html (0 => 164075)


--- trunk/LayoutTests/svg/custom/svg-fonts-skip-ink-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-fonts-skip-ink-expected.html	2014-02-14 00:30:15 UTC (rev 164075)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: 'SVGraffiti';
+    src: url("resources/graffiti.svg#SVGraffiti") format(svg)
+}
+body {
+    font:100px 'SVGraffiti';
+    -webkit-text-decoration-skip: none;
+    text-decoration: underline;
+}
+</style>
+</head>
+<body>
+NSNorth Podcast
+</body>
+</html>

Added: trunk/LayoutTests/svg/custom/svg-fonts-skip-ink.html (0 => 164075)


--- trunk/LayoutTests/svg/custom/svg-fonts-skip-ink.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-fonts-skip-ink.html	2014-02-14 00:30:15 UTC (rev 164075)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: 'SVGraffiti';
+    src: url("resources/graffiti.svg#SVGraffiti") format(svg)
+}
+body {
+    font:100px 'SVGraffiti';
+    -webkit-text-decoration-skip: ink;
+    text-decoration: underline;
+}
+</style>
+</head>
+<body>
+NSNorth Podcast
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (164074 => 164075)


--- trunk/Source/WebCore/ChangeLog	2014-02-14 00:22:45 UTC (rev 164074)
+++ trunk/Source/WebCore/ChangeLog	2014-02-14 00:30:15 UTC (rev 164075)
@@ -1,3 +1,20 @@
+2014-02-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        text-decoration-skip: ink skips randomly when using SVG fonts
+        https://bugs.webkit.org/show_bug.cgi?id=128709
+
+        Reviewed by Simon Fraser.
+
+        This patch simply disables skipping underlines being used with SVG fonts.
+        It's a stopgap until we can support skipping properly with SVG fonts.
+
+        Test: svg/custom/svg-fonts-skip-ink.html
+
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::ctFont):
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::Font::dashesForIntersectionsWithRect):
+
 2014-02-13  Daniel Bates  <daba...@apple.com>
 
         Fix the ARM build when HAVE_ARM_NEON_INTRINSICS is enabled

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (164074 => 164075)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2014-02-14 00:22:45 UTC (rev 164074)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2014-02-14 00:30:15 UTC (rev 164075)
@@ -319,8 +319,10 @@
         else
             fontDescriptor = cascadeToLastResortFontDescriptor();
         m_CTFont = adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, fontDescriptor));
-    } else
+    } else {
+        ASSERT(m_cgFont.get());
         m_CTFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
+    }
 #else
     // Apple Color Emoji size is adjusted (and then re-adjusted by Core Text) and capped.
     CGFloat size = !m_isEmoji ? m_size : m_size <= 15 ? 4 * (m_size + 2) / static_cast<CGFloat>(5) : 16;

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (164074 => 164075)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-02-14 00:22:45 UTC (rev 164074)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-02-14 00:30:15 UTC (rev 164075)
@@ -438,6 +438,9 @@
 
 DashArray Font::dashesForIntersectionsWithRect(const TextRun& run, const FloatPoint& textOrigin, const FloatRect& lineExtents) const
 {
+    if (loadingCustomFonts())
+        return DashArray();
+
     float deltaX;
     GlyphBuffer glyphBuffer;
     if (codePath(run) != Complex)
@@ -449,7 +452,10 @@
     DashArray result;
     for (int i = 0; i < glyphBuffer.size(); ++i) {
         GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x());
-        RetainPtr<CGPathRef> path = adoptCF(CTFontCreatePathForGlyph(glyphBuffer.fontDataAt(i)->platformData().ctFont(), glyphBuffer.glyphAt(i), &translation));
+        const SimpleFontData* fontData = glyphBuffer.fontDataAt(i);
+        if (fontData->isSVGFont())
+            continue;
+        RetainPtr<CGPathRef> path = adoptCF(CTFontCreatePathForGlyph(fontData->platformData().ctFont(), glyphBuffer.glyphAt(i), &translation));
         CGPathApply(path.get(), &info, &findPathIntersections);
         if (info.minX < info.maxX) {
             result.append(info.minX - lineExtents.x());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to