File indexing completed on 2024-04-28 15:24:33
0001 /* 0002 Copyright (C) 2007 Eric Seidel <eric@webkit.org> 0003 Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef SVGFontElement_h 0022 #define SVGFontElement_h 0023 0024 #if ENABLE(SVG_FONTS) 0025 #include "SVGExternalResourcesRequired.h" 0026 #include "SVGGlyphElement.h" 0027 #include "SVGGlyphMap.h" 0028 #include "SVGHKernElement.h" 0029 #include "SVGStyledElement.h" 0030 0031 namespace WebCore 0032 { 0033 0034 class SVGMissingGlyphElement; 0035 class SVGFontElement : public SVGStyledElement 0036 , public SVGExternalResourcesRequired 0037 { 0038 public: 0039 SVGFontElement(const QualifiedName &, Document *); 0040 virtual ~SVGFontElement(); 0041 0042 bool rendererIsNeeded(RenderStyle *) override 0043 { 0044 return false; 0045 } 0046 const SVGElement *contextElement() const override 0047 { 0048 return this; 0049 } 0050 0051 void invalidateGlyphCache(); 0052 0053 void getGlyphIdentifiersForString(const String &, Vector<SVGGlyphIdentifier> &) const; 0054 0055 bool getHorizontalKerningPairForStringsAndGlyphs(const String &u1, const String &g1, const String &u2, const String &g2, SVGHorizontalKerningPair &kerningPair) const; 0056 0057 SVGMissingGlyphElement *firstMissingGlyphElement() const; 0058 0059 // KHTML ElementImpl pure virtual method 0060 quint32 id() const override 0061 { 0062 return SVGNames::textTag.id(); 0063 } 0064 private: 0065 void ensureGlyphCache() const; 0066 0067 typedef Vector<SVGHorizontalKerningPair> KerningPairVector; 0068 0069 mutable KerningPairVector m_kerningPairs; 0070 mutable SVGGlyphMap m_glyphMap; 0071 mutable bool m_isGlyphCacheValid; 0072 }; 0073 0074 } // namespace WebCore 0075 0076 #endif // ENABLE(SVG_FONTS) 0077 #endif 0078