diff options
Diffstat (limited to 'Source/WebCore/svg/SVGFontElement.h')
-rw-r--r-- | Source/WebCore/svg/SVGFontElement.h | 67 |
1 files changed, 10 insertions, 57 deletions
diff --git a/Source/WebCore/svg/SVGFontElement.h b/Source/WebCore/svg/SVGFontElement.h index 89f3b3306..52246bc9a 100644 --- a/Source/WebCore/svg/SVGFontElement.h +++ b/Source/WebCore/svg/SVGFontElement.h @@ -19,91 +19,44 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGFontElement_h -#define SVGFontElement_h +#pragma once #if ENABLE(SVG_FONTS) + #include "SVGAnimatedBoolean.h" #include "SVGElement.h" #include "SVGExternalResourcesRequired.h" -#include "SVGGlyphMap.h" #include "SVGParserUtilities.h" namespace WebCore { -// Describe an SVG <hkern>/<vkern> element already matched on the first symbol. -struct SVGKerning { - float kerning; - UnicodeRanges unicodeRange2; - HashSet<String> unicodeName2; - HashSet<String> glyphName2; - - SVGKerning() - : kerning(0) - { } -}; - // Describe an SVG <hkern>/<vkern> element -struct SVGKerningPair : public SVGKerning { +struct SVGKerningPair { UnicodeRanges unicodeRange1; HashSet<String> unicodeName1; HashSet<String> glyphName1; -}; - -typedef Vector<SVGKerning> SVGKerningVector; -struct SVGKerningMap { - HashMap<String, std::unique_ptr<SVGKerningVector>> unicodeMap; - HashMap<String, std::unique_ptr<SVGKerningVector>> glyphMap; - Vector<SVGKerningPair> kerningUnicodeRangeMap; - - bool isEmpty() const { return unicodeMap.isEmpty() && glyphMap.isEmpty() && kerningUnicodeRangeMap.isEmpty(); } - void clear(); - void insert(const SVGKerningPair&); + UnicodeRanges unicodeRange2; + HashSet<String> unicodeName2; + HashSet<String> glyphName2; + float kerning { 0 }; }; -class SVGMissingGlyphElement; - class SVGFontElement final : public SVGElement , public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGFontElement> create(const QualifiedName&, Document&); - - void invalidateGlyphCache(); - void collectGlyphsForString(const String&, Vector<SVGGlyph>&); - void collectGlyphsForGlyphName(const String&, Vector<SVGGlyph>&); - - float horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; - float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; - - // Used by SimpleFontData/WidthIterator. - SVGGlyph svgGlyphForGlyph(Glyph); - Glyph missingGlyph(); - - const SVGMissingGlyphElement* firstMissingGlyphElement() const; + static Ref<SVGFontElement> create(const QualifiedName&, Document&); private: SVGFontElement(const QualifiedName&, Document&); - virtual bool rendererIsNeeded(const RenderStyle&) override { return false; } - - void ensureGlyphCache(); - void registerLigaturesInGlyphCache(Vector<String>&); + bool rendererIsNeeded(const RenderStyle&) final { return false; } BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement) - DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) END_DECLARE_ANIMATED_PROPERTIES - - SVGKerningMap m_horizontalKerningMap; - SVGKerningMap m_verticalKerningMap; - SVGGlyphMap m_glyphMap; - Glyph m_missingGlyph; - bool m_isGlyphCacheValid; }; -NODE_TYPE_CASTS(SVGFontElement) - } // namespace WebCore #endif // ENABLE(SVG_FONTS) -#endif |