+2015-03-09 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Work around a Cocoa font parsing bug
+ https://bugs.webkit.org/show_bug.cgi?id=142446
+
+ Reviewed by Simon Fraser.
+
+ Adding a few extra tests for bits of SVG fonts that could use some more tests.
+
+ * svg/fonts/resources/svg-font-general.svg: Updated and moved from svg-font-horiz-origin-font.svg
+ * svg/fonts/svg-font-general.html: Updated and moved from svg-font-horiz-origin.html
+ * svg/fonts/svg-font-general-expected.html: Updated and moved from svg-font-horiz-origin-expected.html
+
2015-03-09 Myles C. Maxfield <mmaxfield@apple.com>
[SVG -> OTF Converter] x-height cannot be specified
--- /dev/null
+<?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"/>
+ </font>
+ <font id="Litherum2" horiz-adv-x="1000" horiz-origin-x="500" horiz-origin-y="300">
+ <font-face units-per-em="1000" ascent="1000" descent="0">
+ </font-face>
+ <glyph unicode="A" horiz-adv-x="1000" d="M 0 -300 H 500 V 300 H 0 z"/>
+ </font>
+ <font id="Litherum3" horiz-adv-x="1000">
+ <font-face font-weight="normal" font-style="normal" units-per-em="1000" cap-height="600" x-height="400" ascent="1000" descent="0">
+ </font-face>
+ <glyph unicode="A" d="M 0 0 H 500 V 600 H 0 z"/>
+ <glyph unicode="BC" horiz-adv-x="500" d="M 0 0 H 500 L 250 600 z"/>
+ <glyph unicode="本" horiz-adv-x="500" d="M 0 0 H 500 L 0 600 z"/>
+ </font>
+ <font id="Litherum4" horiz-adv-x="500">
+ <font-face font-weight="normal" font-style="normal" units-per-em="1000" cap-height="600" x-height="400" ascent="1000" descent="0">
+ </font-face>
+ <glyph unicode="A" horiz-adv-x="1000" d="M 0 0 H 500 V 600 H 0 z"/>
+ <glyph unicode="D" horiz-adv-x="500" d="M 0 0 H 500 L 250 600 z"/>
+ <glyph unicode="本" horiz-adv-x="500" d="M 0 0 H 500 L 0 600 z"/>
+ </font>
+ <font id="Litherum5" horiz-adv-x="500">
+ <glyph unicode="A" horiz-adv-x="1000" d="M 0 0 H 250 V 600 H 0 z"/>
+ </font>
+ <font id="Litherum6">
+ <font-face units-per-em="1000" ascent="1000" descent="1000">
+ </font-face>
+ <glyph unicode="A" horiz-adv-x="1000" d="M 0 0 V -1000 H 1000 V 1000 H 0 z"/>
+ <glyph unicode="B" horiz-adv-x="1000" d="M 0 0 H 1000 V 1000 H 0 z"/>
+ </font>
+ <font horiz-adv-x="1000" id="Litherum7">
+ <font-face units-per-em="1000" ascent="1000" descent="0"/>
+ <glyph unicode="A" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 z"/>
+ </font>
+ <font horiz-adv-x="1000" id="Litherum8">
+ <font-face units-per-em="1000" ascent="1000" descent="0"/>
+ <glyph unicode="A" horiz-adv-x="1000" d="M 500 0 H 1000 V 600 z"/>
+ <missing-glyph d="M0 0V1000H1000V0z"/>
+ </font>
+ </defs>
+</svg>
+++ /dev/null
-<?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>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: 'Litherum';
+ src: url("resources/svg-font-general.svg#Litherum2") format(svg);
+}
+@font-face {
+ font-family: 'Litherum4';
+ src: url("resources/svg-font-general.svg#Litherum4") format(svg);
+}
+@font-face {
+ font-family: 'Litherum8';
+ src: url("resources/svg-font-general.svg#Litherum8") format(svg);
+}
+.a {
+ font-family: 'Litherum4';
+}
+</style>
+</head>
+<body style="-webkit-font-smoothing: none;">
+These tests test horiz-origin, fallback of horiz-adv property, glyph rendering, ligatures, svg -> native fallback, and units-per-em, respectively.
+<div><span style="font: 50px Litherum;">AAA</span><span style="position: relative; left: 50px;">AAA</span></div>
+<div><span style="font: 50px Litherum4;">AAA</span>AAA</div>
+<div><div style="display: inline-block; width: 150px; height: 52px; position: relative;"><div style="position: absolute; width: 25px; height: 30px; left: 0px; bottom: 0px; background: black;"></div><div style="position: absolute; width: 25px; height: 30px; left: 50px; bottom: 0px; background: black;"></div><div style="position: absolute; width: 25px; height: 30px; left: 100px; bottom: 0px; background: black;"></div></div>AAA</div>
+<div style="height: 7px;"></div>
+<div><span style="font: 50px Litherum4;">D</span><span style="font-size: 50px;">A</span></div>
+<div style="font-size: 50px;"><span class="a">A</span>Z<span class="a">A</span>Z<span class="a">A</span></span><span class="a">本</span>N<span class="a">本</span>N<span class="a">本</span></span></div>
+<div style="display: inline-block; position: relative; width: 200px; height: 206px;"><div style="position: absolute; top: 2px; left: 0px; width: 50px; height: 100px; background: black;"></div><div style="position: absolute; top: 2px; left: 50px; width: 50px; height: 50px; background: black;"></div><div style="position: absolute; bottom: -1px; left: 0px; width: 50px; height: 100px; background: black;"></div><div style="position: absolute; bottom: 49px; left: 50px; width: 50px; height: 50px; background: black;"></div></div>
+<div style="font: 50px Litherum8; position: absolute; left: 400px; top: 100px;">A</div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+ font-family: 'Litherum';
+ src: url("resources/svg-font-general.svg#Litherum") format(svg);
+}
+@font-face {
+ font-family: 'Litherum3';
+ src: url("resources/svg-font-general.svg#Litherum3") format(svg);
+}
+@font-face {
+ font-family: 'Litherum5';
+ src: url("resources/svg-font-general.svg#Litherum5") format(svg);
+}
+@font-face {
+ font-family: 'Litherum6';
+ src: url("resources/svg-font-general.svg#Litherum6") format(svg);
+}
+@font-face {
+ font-family: 'Litherum7';
+ src: url("resources/svg-font-general.svg#Litherum7") format(svg);
+}
+</style>
+</head>
+<body style="-webkit-font-smoothing: none;">
+These tests test horiz-origin, fallback of horiz-adv property, glyph rendering, ligatures, svg -> native fallback, and units-per-em, respectively.
+<div><span style="font: 50px Litherum;">AAAB</span>AAA</div>
+<div><span style="font: 50px Litherum3;">AAA</span>AAA</div>
+<div><span style="font: 50px Litherum3;">AAA</span>AAA</div>
+<div><span style="font: 50px Litherum3;">BC</span><span style="font: 50px Litherum5;">A</span></div>
+<div style="font-size: 50px;"><span style="font-family: Litherum3, Times;">AZAZA</span><span style="font-family: Times, Litherum3">本N本N本</span></div>
+<div style="font-size: 50px;"><span style="font-family: Litherum6;">AB</span><br/><span style="font-family: Litherum6;">AB</span></div>
+<div style="font: 50px Litherum7; position: absolute; left: 400px; top: 100px;">A</div>
+</body>
+</html>
+++ /dev/null
-<!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>
+++ /dev/null
-<!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>
+2015-03-09 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Work around a Cocoa font parsing bug
+ https://bugs.webkit.org/show_bug.cgi?id=142446
+ <rdar://problem/20086223>
+
+ Reviewed by Simon Fraser.
+
+ Work around a bug in Cocoa regarding font parsing.
+
+ * svg/SVGToOTFFontConversion.cpp:
+
2015-03-09 Csaba Osztrogonác <ossy@webkit.org>
Fix the build after r181153
processGlyphElement(glyphElement, &glyphElement, defaultHorizontalAdvance, defaultVerticalAdvance, unicodeAttribute, initialGlyph);
}
+ // <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));
+
appendLigatureGlyphs();
if (m_glyphs.size() > std::numeric_limits<Glyph>::max()) {