2 Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 Copyright (C) 2008 Rob Buis <buis@kde.org>
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.
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.
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.
22 #ifndef SVGGlyphElement_h
23 #define SVGGlyphElement_h
26 #include "SVGStyledElement.h"
36 // Describe a SVG <glyph> element
37 struct SVGGlyphIdentifier
{
44 // SVG Font depends on exactly this order.
59 , horizontalAdvanceX(0.0f
)
60 , verticalOriginX(0.0f
)
61 , verticalOriginY(0.0f
)
62 , verticalAdvanceY(0.0f
)
66 // Used to mark our float properties as "to be inherited from SVGFontData"
67 static float inheritedValue()
69 static float s_inheritedValue
= std::numeric_limits
<float>::infinity();
70 return s_inheritedValue
;
73 bool operator==(const SVGGlyphIdentifier
& other
) const
75 return isValid
== other
.isValid
&&
76 orientation
== other
.orientation
&&
77 arabicForm
== other
.arabicForm
&&
78 glyphName
== other
.glyphName
&&
79 horizontalAdvanceX
== other
.horizontalAdvanceX
&&
80 verticalOriginX
== other
.verticalOriginX
&&
81 verticalOriginY
== other
.verticalOriginY
&&
82 verticalAdvanceY
== other
.verticalAdvanceY
&&
83 pathData
.debugString() == other
.pathData
.debugString() &&
84 languages
== other
.languages
;
89 unsigned orientation
: 2; // Orientation
90 unsigned arabicForm
: 3; // ArabicForm
95 float horizontalAdvanceX
;
96 float verticalOriginX
;
97 float verticalOriginY
;
98 float verticalAdvanceY
;
101 Vector
<String
> languages
;
104 class SVGGlyphElement
: public SVGStyledElement
{
106 SVGGlyphElement(const QualifiedName
&, Document
*);
107 virtual ~SVGGlyphElement();
109 virtual void parseMappedAttribute(MappedAttribute
*);
111 virtual void insertedIntoDocument();
112 virtual void removedFromDocument();
114 virtual bool rendererIsNeeded(RenderStyle
*) { return false; }
116 SVGGlyphIdentifier
buildGlyphIdentifier() const;
118 // Helper function used by SVGFont
119 static void inheritUnspecifiedAttributes(SVGGlyphIdentifier
&, const SVGFontData
*);
120 static String
querySVGFontLanguage(const SVGElement
*);
122 // Helper function shared between SVGGlyphElement & SVGMissingGlyphElement
123 static SVGGlyphIdentifier
buildGenericGlyphIdentifier(const SVGElement
*);
125 void invalidateGlyphCache();
128 } // namespace WebCore
130 #endif // ENABLE(SVG_FONTS)