[SVG -> OTF Converter] Remove unnecessary hacks
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jun 2015 03:11:11 +0000 (03:11 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jun 2015 03:11:11 +0000 (03:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145088

Reviewed by Simon Fraser.

Source/WebCore:

Not needed anymore.

Test: svg/text/offset-square-svg-font.html

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendKERNTable):
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):

LayoutTests:

Test that the hacks are unnecessary.

* svg/text/offset-square-svg-font-expected.html: Added.
* svg/text/offset-square-svg-font.html: Added.
* svg/text/resources/offset-square-svg-font.svg: Added.
* svg/text/resources/offset-square-svg-font2.svg: Added.

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

LayoutTests/ChangeLog
LayoutTests/svg/text/offset-square-svg-font-expected.html [new file with mode: 0644]
LayoutTests/svg/text/offset-square-svg-font.html [new file with mode: 0644]
LayoutTests/svg/text/resources/offset-square-svg-font.svg [new file with mode: 0644]
LayoutTests/svg/text/resources/offset-square-svg-font2.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGToOTFFontConversion.cpp

index d76c930..e39a176 100644 (file)
@@ -1,3 +1,17 @@
+2015-06-01  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [SVG -> OTF Converter] Remove unnecessary hacks
+        https://bugs.webkit.org/show_bug.cgi?id=145088
+
+        Reviewed by Simon Fraser.
+
+        Test that the hacks are unnecessary.
+
+        * svg/text/offset-square-svg-font-expected.html: Added.
+        * svg/text/offset-square-svg-font.html: Added.
+        * svg/text/resources/offset-square-svg-font.svg: Added.
+        * svg/text/resources/offset-square-svg-font2.svg: Added.
+
 2015-06-01  Zalan Bujtas  <zalan@apple.com>
 
         [Mac] Unreviewed gardening.
diff --git a/LayoutTests/svg/text/offset-square-svg-font-expected.html b/LayoutTests/svg/text/offset-square-svg-font-expected.html
new file mode 100644 (file)
index 0000000..0f73be7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "TestFont";
+    src: url("resources/offset-square-svg-font2.svg") format("svg");
+}
+</style>
+</head>
+<body>
+This test makes sure that a glyph which is an offset square is rendered as expected. The test succeeds if you see a square below.
+<div style="font: 40px TestFont;">ab</div>
+</body>
+</html>
diff --git a/LayoutTests/svg/text/offset-square-svg-font.html b/LayoutTests/svg/text/offset-square-svg-font.html
new file mode 100644 (file)
index 0000000..f046959
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "TestFont";
+    src: url("resources/offset-square-svg-font.svg") format("svg");
+}
+</style>
+</head>
+<body>
+This test makes sure that a glyph which is an offset square is rendered as expected. The test succeeds if you see a square below.
+<div style="font: 40px TestFont;">a</div>
+</body>
+</html>
diff --git a/LayoutTests/svg/text/resources/offset-square-svg-font.svg b/LayoutTests/svg/text/resources/offset-square-svg-font.svg
new file mode 100644 (file)
index 0000000..2cd1042
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
+<defs>
+<font horiz-adv-x="481" id="ascii">
+  <font-face font-family="testfont" units-per-em="1000" ascent="800" descent="-200" alphabetic="0"/>
+<glyph unicode="a" horiz-adv-x="1000" d="M500 0V500H1000V0H500Z"/>
+</font>
+</defs>
+</svg>
diff --git a/LayoutTests/svg/text/resources/offset-square-svg-font2.svg b/LayoutTests/svg/text/resources/offset-square-svg-font2.svg
new file mode 100644 (file)
index 0000000..bb20a6f
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
+<defs>
+<font horiz-adv-x="481" id="ascii">
+  <font-face font-family="testfont" units-per-em="1000" ascent="800" descent="-200" alphabetic="0"/>
+<glyph unicode="a" horiz-adv-x="500" d="M0 0Z"/>
+<glyph unicode="b" horiz-adv-x="500" d="M0 0V500H500V0H0Z"/>
+</font>
+</defs>
+</svg>
index 5e6baf6..4ea2fce 100644 (file)
@@ -1,3 +1,18 @@
+2015-06-01  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [SVG -> OTF Converter] Remove unnecessary hacks
+        https://bugs.webkit.org/show_bug.cgi?id=145088
+
+        Reviewed by Simon Fraser.
+
+        Not needed anymore.
+
+        Test: svg/text/offset-square-svg-font.html
+
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::SVGToOTFFontConverter::appendKERNTable):
+        (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
+
 2015-06-01  Andreas Kling  <akling@apple.com>
 
         CSS animations in filling-forwards state shouldn't force compositing.
index a9b6f46..fc5184c 100644 (file)
@@ -1102,9 +1102,11 @@ void SVGToOTFFontConverter::appendKERNTable()
     size_t sizeOfVerticalSubtable = appendKERNSubtable<SVGVKernElement>(&SVGVKernElement::buildVerticalKerningPair, 0);
     ASSERT_UNUSED(sizeOfVerticalSubtable, subtablesOffset + sizeOfHorizontalSubtable + sizeOfVerticalSubtable == m_result.size());
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED <= 80000)
     // Work around a bug in Apple's font parser by adding some padding bytes. <rdar://problem/18401901>
     for (int i = 0; i < 6; ++i)
         m_result.append(0);
+#endif
 }
 
 template <typename V>
@@ -1398,9 +1400,11 @@ SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement)
             processGlyphElement(glyphElement, &glyphElement, defaultHorizontalAdvance, defaultVerticalAdvance, unicodeAttribute, initialGlyph);
     }
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED <= 80000)
     // <rdar://problem/20086223> Cocoa has a bug where glyph bounding boxes are not correctly respected for frustum culling. Work around this by
     // inflating the font's bounding box
     m_boundingBox.extend(FloatPoint(0, 0));
+#endif
 
     appendLigatureGlyphs();