<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182423] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182423">182423</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-04-06 08:30:49 -0700 (Mon, 06 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Win] [SVG -> OTF Converter] Support the SVG -> OTF Font Converter
https://bugs.webkit.org/show_bug.cgi?id=143402
Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2015-04-06
Reviewed by Darin Adler.
Source/WebCore:
There are a few pieces to the converter that Windows requires that we haven't already
implemented:
1. Checksums were being calculated with the wrong endianness
2. Windows requires a format 4 'cmap' subtable in addition to the format 12 one we already
were using
3. Windows requires a reference to a Private DICT inside the CFF table, even if the DICT
is of 0 length.
Covered by all our existing SVG font tests.
* svg/SVGFontFaceElement.h: Add capHeight accessor.
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::capHeight): Ditto.
* svg/SVGToOTFConversion.cpp: Update the conversion process according to the above
requirements.
(WebCore::SVGToOTFFontConverter::appendFormat12CMAPTable):
(WebCore::SVGToOTFFontConverter::appendFormat4CMAPTable):
(WebCore::SVGToOTFFontConverter::appendCMAPTable): Use helpers.
(WebCore::SVGToOTFFontConverter::appendHHEATable): Use member variables.
(WebCore::SVGToOTFFontConverter::appendOS2Table): Update to version 2.
(WebCore::SVGToOTFFontConverter::appendCFFTable): Create a reference to a
zero-sized Private DICT
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Populate member
variables.
(WebCore::SVGToOTFFontConverter::calculateChecksum): Flip endianness
WebKitLibraries:
* win/tools/vsprops/FeatureDefines.props: Enable the define.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFontFaceElementcpp">trunk/Source/WebCore/svg/SVGFontFaceElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFontFaceElementh">trunk/Source/WebCore/svg/SVGFontFaceElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGToOTFFontConversioncpp">trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp</a></li>
<li><a href="#trunkWebKitLibrariesChangeLog">trunk/WebKitLibraries/ChangeLog</a></li>
<li><a href="#trunkWebKitLibrarieswintoolsvspropsFeatureDefinesprops">trunk/WebKitLibraries/win/tools/vsprops/FeatureDefines.props</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182422 => 182423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-06 15:25:02 UTC (rev 182422)
+++ trunk/Source/WebCore/ChangeLog        2015-04-06 15:30:49 UTC (rev 182423)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-04-06 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [Win] [SVG -> OTF Converter] Support the SVG -> OTF Font Converter
+ https://bugs.webkit.org/show_bug.cgi?id=143402
+
+ Reviewed by Darin Adler.
+
+ There are a few pieces to the converter that Windows requires that we haven't already
+ implemented:
+ 1. Checksums were being calculated with the wrong endianness
+ 2. Windows requires a format 4 'cmap' subtable in addition to the format 12 one we already
+ were using
+ 3. Windows requires a reference to a Private DICT inside the CFF table, even if the DICT
+ is of 0 length.
+
+ Covered by all our existing SVG font tests.
+
+ * svg/SVGFontFaceElement.h: Add capHeight accessor.
+ * svg/SVGFontFaceElement.cpp:
+ (WebCore::SVGFontFaceElement::capHeight): Ditto.
+ * svg/SVGToOTFConversion.cpp: Update the conversion process according to the above
+ requirements.
+ (WebCore::SVGToOTFFontConverter::appendFormat12CMAPTable):
+ (WebCore::SVGToOTFFontConverter::appendFormat4CMAPTable):
+ (WebCore::SVGToOTFFontConverter::appendCMAPTable): Use helpers.
+ (WebCore::SVGToOTFFontConverter::appendHHEATable): Use member variables.
+ (WebCore::SVGToOTFFontConverter::appendOS2Table): Update to version 2.
+ (WebCore::SVGToOTFFontConverter::appendCFFTable): Create a reference to a
+ zero-sized Private DICT
+ (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Populate member
+ variables.
+ (WebCore::SVGToOTFFontConverter::calculateChecksum): Flip endianness
+
</ins><span class="cx"> 2015-04-06 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> Return Optional<uint32_t> from PropertyName::asIndex
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontFaceElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (182422 => 182423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp        2015-04-06 15:25:02 UTC (rev 182422)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp        2015-04-06 15:30:49 UTC (rev 182423)
</span><span class="lines">@@ -86,6 +86,11 @@
</span><span class="cx"> return static_cast<int>(ceilf(fastGetAttribute(x_heightAttr).toFloat()));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int SVGFontFaceElement::capHeight() const
+{
+ return static_cast<int>(ceilf(fastGetAttribute(cap_heightAttr).toFloat()));
+}
+
</ins><span class="cx"> float SVGFontFaceElement::horizontalOriginX() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_fontElement)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontFaceElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.h (182422 => 182423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontFaceElement.h        2015-04-06 15:25:02 UTC (rev 182422)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.h        2015-04-06 15:30:49 UTC (rev 182423)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned unitsPerEm() const;
</span><span class="cx"> int xHeight() const;
</span><ins>+ int capHeight() const;
</ins><span class="cx"> float horizontalOriginX() const;
</span><span class="cx"> float horizontalOriginY() const;
</span><span class="cx"> float horizontalAdvanceX() const;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGToOTFFontConversioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp (182422 => 182423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp        2015-04-06 15:25:02 UTC (rev 182422)
+++ trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp        2015-04-06 15:30:49 UTC (rev 182423)
</span><span class="lines">@@ -192,6 +192,8 @@
</span><span class="cx">
</span><span class="cx"> typedef void (SVGToOTFFontConverter::*FontAppendingFunction)();
</span><span class="cx"> void appendTable(const char identifier[4], FontAppendingFunction);
</span><ins>+ void appendFormat12CMAPTable(const Vector<std::pair<UChar32, Glyph>>& codepointToGlyphMappings);
+ void appendFormat4CMAPTable(const Vector<std::pair<UChar32, Glyph>>& codepointToGlyphMappings);
</ins><span class="cx"> void appendCMAPTable();
</span><span class="cx"> void appendGSUBTable();
</span><span class="cx"> void appendHEADTable();
</span><span class="lines">@@ -241,8 +243,13 @@
</span><span class="cx"> float m_advanceHeightMax;
</span><span class="cx"> float m_minRightSideBearing;
</span><span class="cx"> unsigned m_unitsPerEm;
</span><ins>+ int m_lineGap;
+ int m_xHeight;
+ int m_capHeight;
+ int m_ascent;
+ int m_descent;
</ins><span class="cx"> unsigned m_featureCountGSUB;
</span><del>- int m_tablesAppendedCount;
</del><ins>+ unsigned m_tablesAppendedCount;
</ins><span class="cx"> char m_weight;
</span><span class="cx"> bool m_italic;
</span><span class="cx"> };
</span><span class="lines">@@ -264,16 +271,8 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void SVGToOTFFontConverter::appendCMAPTable()
</del><ins>+void SVGToOTFFontConverter::appendFormat12CMAPTable(const Vector<std::pair<UChar32, Glyph>>& mappings)
</ins><span class="cx"> {
</span><del>- auto startingOffset = m_result.size();
- append16(0);
- append16(1); // Number subtables
-
- append16(0); // Unicode
- append16(3); // Unicode version 2.2+
- append32(m_result.size() - startingOffset + sizeof(uint32_t)); // Byte offset of subtable
-
</del><span class="cx"> // Braindead scheme: One segment for each character
</span><span class="cx"> ASSERT(m_glyphs.size() < 0xFFFF);
</span><span class="cx"> auto subtableLocation = m_result.size();
</span><span class="lines">@@ -281,8 +280,77 @@
</span><span class="cx"> append32(0); // Placeholder for byte length
</span><span class="cx"> append32(0); // Language independent
</span><span class="cx"> append32(0); // Placeholder for nGroups
</span><ins>+ for (auto& mapping : mappings) {
+ append32(mapping.first); // startCharCode
+ append32(mapping.first); // endCharCode
+ append32(mapping.second); // startGlyphCode
+ }
+ overwrite32(subtableLocation + 4, m_result.size() - subtableLocation);
+ overwrite32(subtableLocation + 12, mappings.size());
+}
</ins><span class="cx">
</span><del>- uint16_t nGroups = 0;
</del><ins>+void SVGToOTFFontConverter::appendFormat4CMAPTable(const Vector<std::pair<UChar32, Glyph>>& bmpMappings)
+{
+ auto subtableLocation = m_result.size();
+ append16(4); // Format 4
+ append16(0); // Placeholder for length in bytes
+ append16(0); // Language independent
+ uint16_t segCount = bmpMappings.size() + 1;
+ append16(clampTo<uint16_t>(2 * segCount)); // segCountX2: "2 x segCount"
+ uint16_t originalSearchRange = roundDownToPowerOfTwo(segCount);
+ uint16_t searchRange = clampTo<uint16_t>(2 * originalSearchRange); // searchRange: "2 x (2**floor(log2(segCount)))"
+ append16(searchRange);
+ append16(integralLog2(originalSearchRange)); // entrySelector: "log2(searchRange/2)"
+ append16(clampTo<uint16_t>((2 * segCount) - searchRange)); // rangeShift: "2 x segCount - searchRange"
+
+ // Ending character codes
+ for (auto& mapping : bmpMappings)
+ append16(mapping.first); // startCharCode
+ append16(0xFFFF);
+
+ append16(0); // reserved
+
+ // Starting character codes
+ for (auto& mapping : bmpMappings)
+ append16(mapping.first); // startCharCode
+ append16(0xFFFF);
+
+ // idDelta
+ for (auto& mapping : bmpMappings)
+ append16(static_cast<uint16_t>(mapping.second) - static_cast<uint16_t>(mapping.first)); // startCharCode
+ append16(0x0001);
+
+ // idRangeOffset
+ for (size_t i = 0; i < bmpMappings.size(); ++i)
+ append16(0); // startCharCode
+ append16(0);
+
+ // Fonts strive to hold 2^16 glyphs, but with the current encoding scheme, we write 8 bytes per codepoint into this subtable.
+ // Because the size of this subtable must be represented as a 16-bit number, we are limiting the number of glyphs we support to 2^13.
+ // FIXME: If we hit this limit in the wild, use a more compact encoding scheme for this subtable.
+ overwrite16(subtableLocation + 2, clampTo<uint16_t>(m_result.size() - subtableLocation));
+}
+
+void SVGToOTFFontConverter::appendCMAPTable()
+{
+ auto startingOffset = m_result.size();
+ append16(0);
+ append16(3); // Number of subtables
+
+ append16(0); // Unicode
+ append16(3); // Unicode version 2.2+
+ append32(28); // Byte offset of subtable
+
+ append16(3); // Microsoft
+ append16(1); // Unicode BMP
+ auto format4OffsetLocation = m_result.size();
+ append32(0); // Byte offset of subtable
+
+ append16(3); // Microsoft
+ append16(10); // Unicode
+ append32(28); // Byte offset of subtable
+
+ Vector<std::pair<UChar32, Glyph>> mappings;
</ins><span class="cx"> UChar32 previousCodepoint = std::numeric_limits<UChar32>::max();
</span><span class="cx"> for (size_t i = 0; i < m_glyphs.size(); ++i) {
</span><span class="cx"> auto& glyph = m_glyphs[i];
</span><span class="lines">@@ -299,14 +367,19 @@
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- append32(codepoint); // startCharCode
- append32(codepoint); // endCharCode
- append32(i); // startGlyphCode
- ++nGroups;
</del><ins>+ mappings.append(std::make_pair(codepoint, Glyph(i)));
</ins><span class="cx"> previousCodepoint = codepoint;
</span><span class="cx"> }
</span><del>- overwrite32(subtableLocation + 4, m_result.size() - subtableLocation);
- overwrite32(subtableLocation + 12, nGroups);
</del><ins>+
+ appendFormat12CMAPTable(mappings);
+
+ Vector<std::pair<UChar32, Glyph>> bmpMappings;
+ for (auto& mapping : mappings) {
+ if (mapping.first < 0x10000)
+ bmpMappings.append(mapping);
+ }
+ overwrite32(format4OffsetLocation, m_result.size() - startingOffset);
+ appendFormat4CMAPTable(bmpMappings);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SVGToOTFFontConverter::appendHEADTable()
</span><span class="lines">@@ -343,29 +416,11 @@
</span><span class="cx">
</span><span class="cx"> void SVGToOTFFontConverter::appendHHEATable()
</span><span class="cx"> {
</span><del>- int16_t ascent;
- int16_t descent;
- if (!m_fontFaceElement) {
- ascent = m_unitsPerEm;
- descent = 1;
- } else {
- ascent = m_fontFaceElement->ascent();
- descent = m_fontFaceElement->descent();
-
- // Some platforms, including OS X, use 0 ascent and descent to mean that the platform should synthesize
- // a value based on a heuristic. However, SVG fonts can legitimately have 0 for ascent or descent.
- // Specifing a single FUnit gets us as close to 0 as we can without triggering the synthesis.
- if (!ascent)
- ascent = 1;
- if (!descent)
- descent = 1;
- }
-
</del><span class="cx"> append32(0x00010000); // Version
</span><del>- append16(ascent);
- append16(descent);
</del><ins>+ append16(clampTo<int16_t>(m_ascent));
+ append16(clampTo<int16_t>(m_descent));
</ins><span class="cx"> // WebKit SVG font rendering has hard coded the line gap to be 1/10th of the font size since 2008 (see r29719).
</span><del>- append16(m_unitsPerEm / 10); // Line gap
</del><ins>+ append16(clampTo<int16_t>(m_lineGap));
</ins><span class="cx"> append16(clampTo<uint16_t>(m_advanceWidthMax));
</span><span class="cx"> append16(clampTo<int16_t>(m_boundingBox.x())); // Minimum left side bearing
</span><span class="cx"> append16(clampTo<int16_t>(m_minRightSideBearing)); // Minimum right side bearing
</span><span class="lines">@@ -434,9 +489,9 @@
</span><span class="cx"> if (ok)
</span><span class="cx"> averageAdvance = clampTo<int16_t>(value);
</span><span class="cx">
</span><del>- append16(0); // Version
- append16(averageAdvance);
- append16(m_weight); // Weight class
</del><ins>+ append16(2); // Version
+ append16(clampTo<int16_t>(averageAdvance));
+ append16(clampTo<uint16_t>(m_weight)); // Weight class
</ins><span class="cx"> append16(5); // Width class
</span><span class="cx"> append16(0); // Protected font
</span><span class="cx"> // WebKit handles these superscripts and subscripts
</span><span class="lines">@@ -477,6 +532,20 @@
</span><span class="cx"> append16((m_weight >= 7 ? 1 << 5 : 0) | (m_italic ? 1 : 0)); // Font Patterns.
</span><span class="cx"> append16(0); // First unicode index
</span><span class="cx"> append16(0xFFFF); // Last unicode index
</span><ins>+ append16(clampTo<int16_t>(m_ascent)); // Typographical ascender
+ append16(clampTo<int16_t>(m_descent)); // Typographical descender
+ append16(clampTo<int16_t>(m_lineGap)); // Typographical line gap
+ append16(clampTo<uint16_t>(m_ascent)); // Windows-specific ascent
+ append16(clampTo<uint16_t>(m_descent)); // Windows-specific descent
+ append32(0xFF10FC07); // Bitmask for supported codepages (Part 1). Report all pages as supported.
+ append32(0x0000FFFF); // Bitmask for supported codepages (Part 2). Report all pages as supported.
+ append16(clampTo<int16_t>(m_xHeight)); // x-height
+ append16(clampTo<int16_t>(m_capHeight)); // Cap-height
+ append16(0); // Default char
+ append16(' '); // Break character
+ append16(3); // Maximum context needed to perform font features
+ append16(3); // Smallest optical point size
+ append16(0xFFFF); // Largest optical point size
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SVGToOTFFontConverter::appendPOSTTable()
</span><span class="lines">@@ -548,8 +617,9 @@
</span><span class="cx"> const char fontBBoxKey = 5;
</span><span class="cx"> const char charsetIndexKey = 15;
</span><span class="cx"> const char charstringsIndexKey = 17;
</span><ins>+ const char privateDictIndexKey = 18;
</ins><span class="cx"> const uint32_t userDefinedStringStartIndex = 391;
</span><del>- const unsigned sizeOfTopIndex = 45 + (hasWeight ? 6 : 0);
</del><ins>+ const unsigned sizeOfTopIndex = 56 + (hasWeight ? 6 : 0);
</ins><span class="cx">
</span><span class="cx"> // Top DICT INDEX.
</span><span class="cx"> append16(1); // INDEX contains 1 element
</span><span class="lines">@@ -589,6 +659,11 @@
</span><span class="cx"> unsigned charstringsOffsetLocation = m_result.size();
</span><span class="cx"> append32(0); // Offset of CharStrings INDEX. Will be overwritten later.
</span><span class="cx"> m_result.append(charstringsIndexKey);
</span><ins>+ m_result.append(operand32Bit);
+ append32(0); // 0-sized private dict
+ m_result.append(operand32Bit);
+ append32(0); // no location for private dict
+ m_result.append(privateDictIndexKey); // Private dict size and offset
</ins><span class="cx"> ASSERT(m_result.size() == topDictStart + sizeOfTopIndex);
</span><span class="cx">
</span><span class="cx"> // String INDEX
</span><span class="lines">@@ -1273,7 +1348,6 @@
</span><span class="cx"> , m_advanceWidthMax(0)
</span><span class="cx"> , m_advanceHeightMax(0)
</span><span class="cx"> , m_minRightSideBearing(std::numeric_limits<float>::max())
</span><del>- , m_unitsPerEm(0)
</del><span class="cx"> , m_featureCountGSUB(0)
</span><span class="cx"> , m_tablesAppendedCount(0)
</span><span class="cx"> , m_weight(5)
</span><span class="lines">@@ -1287,6 +1361,30 @@
</span><span class="cx"> if (m_fontFaceElement)
</span><span class="cx"> m_unitsPerEm = m_fontFaceElement->unitsPerEm();
</span><span class="cx">
</span><ins>+ if (!m_fontFaceElement) {
+ m_unitsPerEm = 1;
+ m_ascent = m_unitsPerEm;
+ m_descent = 1;
+ m_xHeight = m_unitsPerEm;
+ m_capHeight = m_ascent;
+ } else {
+ m_unitsPerEm = m_fontFaceElement->unitsPerEm();
+ m_ascent = m_fontFaceElement->ascent();
+ m_descent = m_fontFaceElement->descent();
+ m_xHeight = m_fontFaceElement->xHeight();
+ m_capHeight = m_fontFaceElement->capHeight();
+
+ // Some platforms, including OS X, use 0 ascent and descent to mean that the platform should synthesize
+ // a value based on a heuristic. However, SVG fonts can legitimately have 0 for ascent or descent.
+ // Specifing a single FUnit gets us as close to 0 as we can without triggering the synthesis.
+ if (!m_ascent)
+ m_ascent = 1;
+ if (!m_descent)
+ m_descent = 1;
+ }
+
+ m_lineGap = m_unitsPerEm / 10;
+
</ins><span class="cx"> populateEmptyGlyphCharString(m_emptyGlyphCharString, m_unitsPerEm);
</span><span class="cx">
</span><span class="cx"> if (m_missingGlyphElement)
</span><span class="lines">@@ -1369,10 +1467,10 @@
</span><span class="cx"> ASSERT(isFourByteAligned(endingOffset - startingOffset));
</span><span class="cx"> uint32_t sum = 0;
</span><span class="cx"> for (size_t offset = startingOffset; offset < endingOffset; offset += 4) {
</span><del>- sum += (static_cast<unsigned char>(m_result[offset + 3]) << 24)
- | (static_cast<unsigned char>(m_result[offset + 2]) << 16)
- | (static_cast<unsigned char>(m_result[offset + 1]) << 8)
- | static_cast<unsigned char>(m_result[offset]);
</del><ins>+ sum += static_cast<unsigned char>(m_result[offset + 3])
+ | (static_cast<unsigned char>(m_result[offset + 2]) << 8)
+ | (static_cast<unsigned char>(m_result[offset + 1]) << 16)
+ | (static_cast<unsigned char>(m_result[offset]) << 24);
</ins><span class="cx"> }
</span><span class="cx"> return sum;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebKitLibrariesChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/ChangeLog (182422 => 182423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/ChangeLog        2015-04-06 15:25:02 UTC (rev 182422)
+++ trunk/WebKitLibraries/ChangeLog        2015-04-06 15:30:49 UTC (rev 182423)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-04-06 Myles C. Maxfield <mmaxfield@apple.com>
+
+ [Win] [SVG -> OTF Converter] Support the SVG -> OTF Font Converter
+ https://bugs.webkit.org/show_bug.cgi?id=143402
+
+ Reviewed by Darin Adler.
+
+ * win/tools/vsprops/FeatureDefines.props: Enable the define.
+
</ins><span class="cx"> 2015-03-09 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Add WebKitSystemInterface for iOS 8.2
</span></span></pre></div>
<a id="trunkWebKitLibrarieswintoolsvspropsFeatureDefinesprops"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/win/tools/vsprops/FeatureDefines.props (182422 => 182423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/win/tools/vsprops/FeatureDefines.props        2015-04-06 15:25:02 UTC (rev 182422)
+++ trunk/WebKitLibraries/win/tools/vsprops/FeatureDefines.props        2015-04-06 15:30:49 UTC (rev 182423)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> <ENABLE_SVG>ENABLE_SVG</ENABLE_SVG>
</span><span class="cx"> <ENABLE_SVG_DOM_OBJC_BINDINGS />
</span><span class="cx"> <ENABLE_SVG_FONTS>ENABLE_SVG_FONTS</ENABLE_SVG_FONTS>
</span><del>- <ENABLE_SVG_OTF_CONVERTER />
</del><ins>+ <ENABLE_SVG_OTF_CONVERTER>ENABLE_SVG_OTF_CONVERTER</ENABLE_SVG_OTF_CONVERTER>
</ins><span class="cx"> <ENABLE_TEMPLATE_ELEMENT>ENABLE_TEMPLATE_ELEMENT</ENABLE_TEMPLATE_ELEMENT>
</span><span class="cx"> <ENABLE_TEXT_AUTOSIZING />
</span><span class="cx"> <ENABLE_VIDEO>ENABLE_VIDEO</ENABLE_VIDEO>
</span></span></pre>
</div>
</div>
</body>
</html>