KHTML
SVGGlyphElement.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SVGGlyphElement_h
00022 #define SVGGlyphElement_h
00023
00024 #if ENABLE(SVG_FONTS)
00025 #include "SVGStyledElement.h"
00026
00027 #include <limits>
00028 #include "Path.h"
00029
00030 namespace khtml
00031 {
00032 class AtomicString;
00033 }
00034
00035 namespace WebCore {
00036
00037 using khtml::AtomicString;
00038 struct SVGFontData;
00039
00040
00041 struct SVGGlyphIdentifier {
00042 enum Orientation {
00043 Vertical,
00044 Horizontal,
00045 Both
00046 };
00047
00048
00049 enum ArabicForm {
00050 None = 0,
00051 Isolated,
00052 Terminal,
00053 Initial,
00054 Medial
00055 };
00056
00057 SVGGlyphIdentifier()
00058 : isValid(false)
00059 , orientation(Both)
00060 , arabicForm(None)
00061 , priority(0)
00062 , nameLength(0)
00063 , horizontalAdvanceX(0.0f)
00064 , verticalOriginX(0.0f)
00065 , verticalOriginY(0.0f)
00066 , verticalAdvanceY(0.0f)
00067 {
00068 }
00069
00070
00071 static float inheritedValue()
00072 {
00073 static float s_inheritedValue = std::numeric_limits<float>::infinity();
00074 return s_inheritedValue;
00075 }
00076
00077 bool operator==(const SVGGlyphIdentifier& other) const
00078 {
00079 return isValid == other.isValid &&
00080 orientation == other.orientation &&
00081 arabicForm == other.arabicForm &&
00082 glyphName == other.glyphName &&
00083 horizontalAdvanceX == other.horizontalAdvanceX &&
00084 verticalOriginX == other.verticalOriginX &&
00085 verticalOriginY == other.verticalOriginY &&
00086 verticalAdvanceY == other.verticalAdvanceY &&
00087 pathData.debugString() == other.pathData.debugString() &&
00088 languages == other.languages;
00089 }
00090
00091 bool isValid : 1;
00092
00093 Orientation orientation : 2;
00094 ArabicForm arabicForm : 3;
00095 int priority;
00096 size_t nameLength;
00097 String glyphName;
00098
00099 float horizontalAdvanceX;
00100 float verticalOriginX;
00101 float verticalOriginY;
00102 float verticalAdvanceY;
00103
00104 Path pathData;
00105 Vector<String> languages;
00106 };
00107
00108 class SVGGlyphElement : public SVGStyledElement {
00109 public:
00110 SVGGlyphElement(const QualifiedName&, Document*);
00111 virtual ~SVGGlyphElement();
00112
00113 virtual void insertedIntoDocument();
00114 virtual void removedFromDocument();
00115
00116 virtual bool rendererIsNeeded(RenderStyle*) { return false; }
00117
00118 SVGGlyphIdentifier buildGlyphIdentifier() const;
00119
00120
00121 static void inheritUnspecifiedAttributes(SVGGlyphIdentifier&, const SVGFontData*);
00122 static String querySVGFontLanguage(const SVGElement*);
00123
00124
00125 static SVGGlyphIdentifier buildGenericGlyphIdentifier(const SVGElement*);
00126 };
00127
00128 }
00129
00130 #endif // ENABLE(SVG_FONTS)
00131 #endif