Modified: trunk/Source/WebCore/ChangeLog (174010 => 174011)
--- trunk/Source/WebCore/ChangeLog 2014-09-26 17:02:37 UTC (rev 174010)
+++ trunk/Source/WebCore/ChangeLog 2014-09-26 17:18:57 UTC (rev 174011)
@@ -1,3 +1,35 @@
+2014-09-26 Myles C. Maxfield <[email protected]>
+
+ SVG -> OTF converter bug gardening
+ https://bugs.webkit.org/show_bug.cgi?id=137088
+
+ Reviewed by Darin Adler.
+
+ This test fixes some (but not all) of the svg/ layout tests that never worked with the
+ SVG -> OTF font converter. The actual list of tests this fixes is shown below. I will be
+ filing bugs for the remaining issues along with the relevant tests that those issues
+ cause to fail.
+
+ Tests: svg/W3C-SVG-1.1/fonts-elem-05-t.svg
+ svg/W3C-SVG-1.1/fonts-kern-01-t.svg
+ svg/custom/glyph-setting-d-attribute.svg
+ svg/custom/scrolling-embedded-svg-file-image-repaint-problem.html
+ svg/custom/skip-underline-missing-glyph.html
+ svg/custom/svg-fonts-fallback.xhtml
+ svg/custom/svg-fonts-in-text-controls.html
+
+ * svg/SVGToOTFFontConversion.cpp:
+ (WebCore::SVGToOTFFontConverter::appendHEADTable): We use the font's minimum and maximum
+ bounding box information to size <textarea>s and <input>s.
+ (WebCore::SVGToOTFFontConverter::addCodepointRanges): Codepoint ranges are closed.
+ (WebCore::SVGToOTFFontConverter::computeKerningData): Typo in appending glyphs to the
+ wrong set.
+ (WebCore::SVGToOTFFontConverter::transcodeGlyphPaths): Use the font's horizontal
+ origin if the glyph doesn't have one.
+ (WebCore::SVGToOTFFontConverter::convertSVGToOTFFont): r173852 implemented vhea, vmtx,
+ and kern.
+ (WebCore::transcodeGlyphPaths): Moved inside SVGToOTFFontConverter.
+
2014-09-26 Dan Bernstein <[email protected]>
iOS build fix following r173989.
Modified: trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp (174010 => 174011)
--- trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp 2014-09-26 17:02:37 UTC (rev 174010)
+++ trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp 2014-09-26 17:18:57 UTC (rev 174011)
@@ -130,6 +130,9 @@
void appendCFFTable(Vector<char>&) const;
void appendVORGTable(Vector<char>&) const;
+ template <typename T>
+ Vector<char> transcodeGlyphPaths(float width, const T& glyphElement, FloatRect& boundingBox) const;
+
void addCodepointRanges(const UnicodeRanges&, HashSet<uint16_t>& glyphSet) const;
void addCodepoints(const HashSet<String>& codepoints, HashSet<uint16_t>& glyphSet) const;
void addGlyphNames(const HashSet<String>& glyphNames, HashSet<uint16_t>& glyphSet) const;
@@ -228,10 +231,10 @@
write32(result, 0); // Last half of creation date
write32(result, 0); // First half of modification date
write32(result, 0); // Last half of modification date
- write16(result, std::numeric_limits<int16_t>::min()); // Minimum X
- write16(result, std::numeric_limits<int16_t>::min()); // Minimum Y
- write16(result, std::numeric_limits<int16_t>::max()); // Maximum X
- write16(result, std::numeric_limits<int16_t>::max()); // Maximum Y
+ write16(result, m_boundingBox.x()); // Minimum X
+ write16(result, m_boundingBox.y()); // Minimum Y
+ write16(result, m_boundingBox.maxX()); // Maximum X
+ write16(result, m_boundingBox.maxY()); // Maximum Y
write16(result, (m_italic ? 1 << 1 : 0) | (m_weight >= 7 ? 1 : 0));
write16(result, 3); // Smallest readable size in pixels
write16(result, 0); // Might contain LTR or RTL glyphs
@@ -603,7 +606,7 @@
void SVGToOTFFontConverter::addCodepointRanges(const UnicodeRanges& unicodeRanges, HashSet<Glyph>& glyphSet) const
{
for (auto& unicodeRange : unicodeRanges) {
- for (auto codepoint = unicodeRange.first; codepoint < unicodeRange.second; ++codepoint) {
+ for (auto codepoint = unicodeRange.first; codepoint <= unicodeRange.second; ++codepoint) {
if (!codepoint || codepoint >= std::numeric_limits<Codepoint>::max())
continue;
auto iterator = m_codepointToIndexMap.find(codepoint);
@@ -660,7 +663,7 @@
addGlyphNames(kerningPair.glyphName1, glyphSet1);
addGlyphNames(kerningPair.glyphName2, glyphSet2);
addCodepoints(kerningPair.unicodeName1, glyphSet1);
- addCodepoints(kerningPair.unicodeName2, glyphSet1);
+ addCodepoints(kerningPair.unicodeName2, glyphSet2);
// FIXME: Use table format 2 so we don't have to append each of these one by one
for (auto& glyph1 : glyphSet1) {
@@ -835,7 +838,7 @@
};
template <typename T>
-static Vector<char> transcodeGlyphPaths(float width, const T& glyphElement, FloatRect& boundingBox)
+Vector<char> SVGToOTFFontConverter::transcodeGlyphPaths(float width, const T& glyphElement, FloatRect& boundingBox) const
{
Vector<char> result;
auto& dAttribute = glyphElement.fastGetAttribute(SVGNames::dAttr);
@@ -851,11 +854,11 @@
// FIXME: If we are vertical, use vert_origin_x and vert_origin_y
bool ok;
float horizontalOriginX = glyphElement.fastGetAttribute(SVGNames::horiz_origin_xAttr).toFloat(&ok);
- if (!ok)
- horizontalOriginX = 0;
+ if (!ok && m_fontFaceElement)
+ horizontalOriginX = m_fontFaceElement->horizontalOriginX();
float horizontalOriginY = glyphElement.fastGetAttribute(SVGNames::horiz_origin_yAttr).toFloat(&ok);
- if (!ok)
- horizontalOriginY = 0;
+ if (!ok && m_fontFaceElement)
+ horizontalOriginY = m_fontFaceElement->horizontalOriginY();
CFFBuilder builder(result, width, FloatPoint(horizontalOriginX, horizontalOriginY));
SVGPathStringSource source(dAttribute);
@@ -1062,7 +1065,6 @@
for (size_t i = 0; i < kDirectoryEntrySize * numTables; ++i)
result.append(0);
- // FIXME: Implement more tables, like vhea and vmtx (and kern!)
appendTable("CFF ", result, &SVGToOTFFontConverter::appendCFFTable);
appendTable("OS/2", result, &SVGToOTFFontConverter::appendOS2Table);
appendTable("VORG", result, &SVGToOTFFontConverter::appendVORGTable);