Ignore:
Timestamp:
Jan 10, 2016, 9:55:14 PM (9 years ago)
Author:
[email protected]
Message:

[SVG -> OTF Converter] Parsing failures cause use of incomplete fonts
https://bugs.webkit.org/show_bug.cgi?id=152772
<rdar://problem/24043104>

Reviewed by Simon Fraser.

Source/WebCore:

Originally, if we fail to parse a glyph, we would simply skip the glyph. However, this means that
we will create an incomplete font without all the necessary glyphs. This causes very distressing
text where all the occurances of a particular letter are missing. Instead, we should treat the
entire font as invalid.

Test: fast/text/svg-font-invalid-glyph-path-failure.html

  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::font):

  • loader/cache/CachedSVGFont.cpp:

(WebCore::CachedSVGFont::ensureCustomFontData):

  • svg/SVGToOTFFontConversion.cpp:

(WebCore::SVGToOTFFontConverter::error):
(WebCore::SVGToOTFFontConverter::transcodeGlyphPaths):
(WebCore::SVGToOTFFontConverter::processGlyphElement):
(WebCore::convertSVGToOTFFont):

  • svg/SVGToOTFFontConversion.h:

LayoutTests:

Make sure the font renders as if its invalid.

  • fast/text/resources/bustedfont.svg: Added.
  • fast/text/svg-font-invalid-glyph-path-failure-expected.html: Added.
  • fast/text/svg-font-invalid-glyph-path-failure.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSFontFaceSource.cpp

    r194496 r194839  
    145145                // FIXME: Re-run this when script modifies the element or any of its descendents
    146146                // FIXME: We might have already converted this font. Make existing conversions discoverable.
    147                 Vector<char> otfFont = convertSVGToOTFFont(fontElement);
    148                 m_generatedOTFBuffer = SharedBuffer::adoptVector(otfFont);
     147                if (auto otfFont = convertSVGToOTFFont(fontElement))
     148                    m_generatedOTFBuffer = SharedBuffer::adoptVector(otfFont.value());
    149149                if (!m_generatedOTFBuffer)
    150150                    return nullptr;
Note: See TracChangeset for help on using the changeset viewer.