KHTML
SVGGlyphElement.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2007 Eric Seidel <eric@webkit.org> 00003 Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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 // Describe a SVG <glyph> element 00041 struct SVGGlyphIdentifier { 00042 enum Orientation { 00043 Vertical, 00044 Horizontal, 00045 Both 00046 }; 00047 00048 // SVG Font depends on exactly this order. 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 // Used to mark our float properties as "to be inherited from SVGFontData" 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 // Helper function used by SVGFont 00121 static void inheritUnspecifiedAttributes(SVGGlyphIdentifier&, const SVGFontData*); 00122 static String querySVGFontLanguage(const SVGElement*); 00123 00124 // Helper function shared between SVGGlyphElement & SVGMissingGlyphElement 00125 static SVGGlyphIdentifier buildGenericGlyphIdentifier(const SVGElement*); 00126 }; 00127 00128 } // namespace WebCore 00129 00130 #endif // ENABLE(SVG_FONTS) 00131 #endif
KDE 4.6 API Reference