Changeset 174011 in webkit


Ignore:
Timestamp:
Sep 26, 2014 10:18:57 AM (10 years ago)
Author:
mmaxfield@apple.com
Message:

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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r174010 r174011  
     12014-09-26  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        SVG -> OTF converter bug gardening
     4        https://bugs.webkit.org/show_bug.cgi?id=137088
     5
     6        Reviewed by Darin Adler.
     7
     8        This test fixes some (but not all) of the svg/ layout tests that never worked with the
     9        SVG -> OTF font converter. The actual list of tests this fixes is shown below. I will be
     10        filing bugs for the remaining issues along with the relevant tests that those issues
     11        cause to fail.
     12
     13        Tests: svg/W3C-SVG-1.1/fonts-elem-05-t.svg
     14               svg/W3C-SVG-1.1/fonts-kern-01-t.svg
     15               svg/custom/glyph-setting-d-attribute.svg
     16               svg/custom/scrolling-embedded-svg-file-image-repaint-problem.html
     17               svg/custom/skip-underline-missing-glyph.html
     18               svg/custom/svg-fonts-fallback.xhtml
     19               svg/custom/svg-fonts-in-text-controls.html
     20
     21        * svg/SVGToOTFFontConversion.cpp:
     22        (WebCore::SVGToOTFFontConverter::appendHEADTable): We use the font's minimum and maximum
     23        bounding box information to size <textarea>s and <input>s.
     24        (WebCore::SVGToOTFFontConverter::addCodepointRanges): Codepoint ranges are closed.
     25        (WebCore::SVGToOTFFontConverter::computeKerningData): Typo in appending glyphs to the
     26        wrong set.
     27        (WebCore::SVGToOTFFontConverter::transcodeGlyphPaths): Use the font's horizontal
     28        origin if the glyph doesn't have one.
     29        (WebCore::SVGToOTFFontConverter::convertSVGToOTFFont): r173852 implemented vhea, vmtx,
     30        and kern.
     31        (WebCore::transcodeGlyphPaths): Moved inside SVGToOTFFontConverter.
     32
    1332014-09-26  Dan Bernstein  <mitz@apple.com>
    234
  • trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp

    r173852 r174011  
    131131    void appendVORGTable(Vector<char>&) const;
    132132
     133    template <typename T>
     134    Vector<char> transcodeGlyphPaths(float width, const T& glyphElement, FloatRect& boundingBox) const;
     135
    133136    void addCodepointRanges(const UnicodeRanges&, HashSet<uint16_t>& glyphSet) const;
    134137    void addCodepoints(const HashSet<String>& codepoints, HashSet<uint16_t>& glyphSet) const;
     
    229232    write32(result, 0); // First half of modification date
    230233    write32(result, 0); // Last half of modification date
    231     write16(result, std::numeric_limits<int16_t>::min()); // Minimum X
    232     write16(result, std::numeric_limits<int16_t>::min()); // Minimum Y
    233     write16(result, std::numeric_limits<int16_t>::max()); // Maximum X
    234     write16(result, std::numeric_limits<int16_t>::max()); // Maximum Y
     234    write16(result, m_boundingBox.x()); // Minimum X
     235    write16(result, m_boundingBox.y()); // Minimum Y
     236    write16(result, m_boundingBox.maxX()); // Maximum X
     237    write16(result, m_boundingBox.maxY()); // Maximum Y
    235238    write16(result, (m_italic ? 1 << 1 : 0) | (m_weight >= 7 ? 1 : 0));
    236239    write16(result, 3); // Smallest readable size in pixels
     
    604607{
    605608    for (auto& unicodeRange : unicodeRanges) {
    606         for (auto codepoint = unicodeRange.first; codepoint < unicodeRange.second; ++codepoint) {
     609        for (auto codepoint = unicodeRange.first; codepoint <= unicodeRange.second; ++codepoint) {
    607610            if (!codepoint || codepoint >= std::numeric_limits<Codepoint>::max())
    608611                continue;
     
    661664            addGlyphNames(kerningPair.glyphName2, glyphSet2);
    662665            addCodepoints(kerningPair.unicodeName1, glyphSet1);
    663             addCodepoints(kerningPair.unicodeName2, glyphSet1);
     666            addCodepoints(kerningPair.unicodeName2, glyphSet2);
    664667
    665668            // FIXME: Use table format 2 so we don't have to append each of these one by one
     
    836839
    837840template <typename T>
    838 static Vector<char> transcodeGlyphPaths(float width, const T& glyphElement, FloatRect& boundingBox)
     841Vector<char> SVGToOTFFontConverter::transcodeGlyphPaths(float width, const T& glyphElement, FloatRect& boundingBox) const
    839842{
    840843    Vector<char> result;
     
    852855    bool ok;
    853856    float horizontalOriginX = glyphElement.fastGetAttribute(SVGNames::horiz_origin_xAttr).toFloat(&ok);
    854     if (!ok)
    855         horizontalOriginX = 0;
     857    if (!ok && m_fontFaceElement)
     858        horizontalOriginX = m_fontFaceElement->horizontalOriginX();
    856859    float horizontalOriginY = glyphElement.fastGetAttribute(SVGNames::horiz_origin_yAttr).toFloat(&ok);
    857     if (!ok)
    858         horizontalOriginY = 0;
     860    if (!ok && m_fontFaceElement)
     861        horizontalOriginY = m_fontFaceElement->horizontalOriginY();
    859862
    860863    CFFBuilder builder(result, width, FloatPoint(horizontalOriginX, horizontalOriginY));
     
    10631066        result.append(0);
    10641067
    1065     // FIXME: Implement more tables, like vhea and vmtx (and kern!)
    10661068    appendTable("CFF ", result, &SVGToOTFFontConverter::appendCFFTable);
    10671069    appendTable("OS/2", result, &SVGToOTFFontConverter::appendOS2Table);
Note: See TracChangeset for help on using the changeset viewer.