|
1 /* |
|
2 Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
|
3 Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
|
4 Copyright (C) Research In Motion Limited 2010. All rights reserved. |
|
5 |
|
6 This library is free software; you can redistribute it and/or |
|
7 modify it under the terms of the GNU Library General Public |
|
8 License as published by the Free Software Foundation; either |
|
9 version 2 of the License, or (at your option) any later version. |
|
10 |
|
11 This library is distributed in the hope that it will be useful, |
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 Library General Public License for more details. |
|
15 |
|
16 You should have received a copy of the GNU Library General Public License |
|
17 along with this library; see the file COPYING.LIB. If not, write to |
|
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
|
20 */ |
|
21 |
|
22 #ifndef SVGFontElement_h |
|
23 #define SVGFontElement_h |
|
24 |
|
25 #if ENABLE(SVG_FONTS) |
|
26 #include "SVGExternalResourcesRequired.h" |
|
27 #include "SVGGlyphElement.h" |
|
28 #include "SVGGlyphMap.h" |
|
29 #include "SVGParserUtilities.h" |
|
30 #include "SVGStyledElement.h" |
|
31 |
|
32 namespace WebCore { |
|
33 |
|
34 // Describe an SVG <hkern>/<vkern> element |
|
35 struct SVGKerningPair { |
|
36 float kerning; |
|
37 UnicodeRanges unicodeRange1; |
|
38 UnicodeRanges unicodeRange2; |
|
39 HashSet<String> unicodeName1; |
|
40 HashSet<String> unicodeName2; |
|
41 HashSet<String> glyphName1; |
|
42 HashSet<String> glyphName2; |
|
43 |
|
44 SVGKerningPair() |
|
45 : kerning(0.0f) |
|
46 { |
|
47 } |
|
48 }; |
|
49 |
|
50 typedef Vector<SVGKerningPair> KerningPairVector; |
|
51 |
|
52 class SVGMissingGlyphElement; |
|
53 class SVGFontElement : public SVGStyledElement |
|
54 , public SVGExternalResourcesRequired { |
|
55 public: |
|
56 SVGFontElement(const QualifiedName&, Document*); |
|
57 virtual ~SVGFontElement(); |
|
58 |
|
59 virtual void synchronizeProperty(const QualifiedName&); |
|
60 virtual bool rendererIsNeeded(RenderStyle*) { return false; } |
|
61 |
|
62 void invalidateGlyphCache(); |
|
63 |
|
64 void getGlyphIdentifiersForString(const String&, Vector<SVGGlyphIdentifier>&) const; |
|
65 |
|
66 float horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; |
|
67 float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; |
|
68 |
|
69 SVGMissingGlyphElement* firstMissingGlyphElement() const; |
|
70 |
|
71 private: |
|
72 // SVGExternalResourcesRequired |
|
73 DECLARE_ANIMATED_PROPERTY(SVGFontElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) |
|
74 |
|
75 void ensureGlyphCache() const; |
|
76 |
|
77 mutable KerningPairVector m_horizontalKerningPairs; |
|
78 mutable KerningPairVector m_verticalKerningPairs; |
|
79 mutable SVGGlyphMap m_glyphMap; |
|
80 mutable bool m_isGlyphCacheValid; |
|
81 }; |
|
82 |
|
83 } // namespace WebCore |
|
84 |
|
85 #endif // ENABLE(SVG_FONTS) |
|
86 #endif |