Test horiz-origin-x and horiz-origin-y in SVG fonts
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2015 18:21:36 +0000 (18:21 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2015 18:21:36 +0000 (18:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142403

Source/WebCore:

Reviewed by Simon Fraser.

Remove incorrect comment.

Test: svg/fonts/svg-font-horiz-origin.html

* svg/SVGToOTFFontConversion.cpp:
(WebCore::CFFBuilder::CFFBuilder):

LayoutTests:

Simply moving to the origin in glyph-space at the beginning
of path parsing won't work if subsequent coordinates are absolute.

Reviewed by Simon Fraser.

* svg/fonts/resources/svg-font-horiz-origin-font.svg: Added.
* svg/fonts/svg-font-horiz-origin-expected.html: Added.
* svg/fonts/svg-font-horiz-origin.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/svg/fonts/resources/svg-font-horiz-origin-font.svg [new file with mode: 0644]
LayoutTests/svg/fonts/svg-font-horiz-origin-expected.html [new file with mode: 0644]
LayoutTests/svg/fonts/svg-font-horiz-origin.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGToOTFFontConversion.cpp

index b59636c..90ae106 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Test horiz-origin-x and horiz-origin-y in SVG fonts
+        https://bugs.webkit.org/show_bug.cgi?id=142403
+
+        Simply moving to the origin in glyph-space at the beginning
+        of path parsing won't work if subsequent coordinates are absolute.
+
+        Reviewed by Simon Fraser.
+
+        * svg/fonts/resources/svg-font-horiz-origin-font.svg: Added.
+        * svg/fonts/svg-font-horiz-origin-expected.html: Added.
+        * svg/fonts/svg-font-horiz-origin.html: Added.
+
 2015-03-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         An SVG element without intrinsic size inherits the container size as its viewport instead of inheriting the container viewport.
diff --git a/LayoutTests/svg/fonts/resources/svg-font-horiz-origin-font.svg b/LayoutTests/svg/fonts/resources/svg-font-horiz-origin-font.svg
new file mode 100644 (file)
index 0000000..ea6da9d
--- /dev/null
@@ -0,0 +1,21 @@
+<?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 font-family="Litherum" font-weight="normal" font-style="normal" units-per-em="1000" cap-height="600" x-height="400" ascent="1000" descent="0" alphabetic="0" mathematical="500" ideographic="400" hanging="500">
+        <font-face-src>
+          <font-face-name name="Litherum"/>
+        </font-face-src>
+      </font-face>
+    <glyph unicode="A" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 H 500 z"/>
+    </font>
+    <font id="Litherum2" horiz-adv-x="1000" horiz-origin-x="500" horiz-origin-y="300">
+      <font-face font-family="Litherum" font-weight="normal" font-style="normal" units-per-em="1000" cap-height="600" x-height="400" ascent="1000" descent="0" alphabetic="0" mathematical="500" ideographic="400" hanging="500">
+        <font-face-src>
+          <font-face-name name="Litherum"/>
+        </font-face-src>
+      </font-face>
+    <glyph unicode="A" horiz-adv-x="1000" d="M 0 -300 H 500 V 300 H 0 z"/>
+    </font>
+  </defs>
+</svg>
diff --git a/LayoutTests/svg/fonts/svg-font-horiz-origin-expected.html b/LayoutTests/svg/fonts/svg-font-horiz-origin-expected.html
new file mode 100644 (file)
index 0000000..009d7d1
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: 'Litherum';
+    src: url("resources/svg-font-horiz-origin-font.svg#Litherum2") format(svg)
+}
+</style>
+</head>
+<body>
+This test makes sure that the horiz-origin-x and horiz-origin-y attributes are correctly converted.
+<div><span style="font: 48px Litherum;">AAA</span>AAA</div>
+</body>
+</html>
diff --git a/LayoutTests/svg/fonts/svg-font-horiz-origin.html b/LayoutTests/svg/fonts/svg-font-horiz-origin.html
new file mode 100644 (file)
index 0000000..67f0a14
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: 'Litherum';
+    src: url("resources/svg-font-horiz-origin-font.svg#Litherum") format(svg)
+}
+</style>
+</head>
+<body>
+This test makes sure that the horiz-origin-x and horiz-origin-y attributes are correctly converted.
+<div><span style="font: 48px Litherum;">AAA</span>AAA</div>
+</body>
+</html>
index d5ee6a8..07c2d5f 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Test horiz-origin-x and horiz-origin-y in SVG fonts
+        https://bugs.webkit.org/show_bug.cgi?id=142403
+
+        Reviewed by Simon Fraser.
+
+        Remove incorrect comment.
+
+        Test: svg/fonts/svg-font-horiz-origin.html
+
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::CFFBuilder::CFFBuilder):
+
 2015-03-06  Simon Fraser  <simon.fraser@apple.com>
 
         Allow tree dumping functions to be used in release builds by switching a flag
index 8a4d693..9466a42 100644 (file)
@@ -1051,7 +1051,6 @@ public:
         : m_cffData(cffData)
         , m_hasBoundingBox(false)
     {
-        // FIXME: Moving to the origin isn't going to work for subsequent absolute coordinates
         writeCFFEncodedNumber(m_cffData, width);
         writeCFFEncodedNumber(m_cffData, origin.x());
         writeCFFEncodedNumber(m_cffData, origin.y());