KHtml

SVGGlyphElement.h
1 /*
2  Copyright (C) 2007 Eric Seidel <[email protected]>
3  Copyright (C) 2007 Nikolas Zimmermann <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef SVGGlyphElement_h
22 #define SVGGlyphElement_h
23 
24 #if ENABLE(SVG_FONTS)
25 #include "SVGStyledElement.h"
26 
27 #include <limits>
28 #include "Path.h"
29 
30 namespace khtml
31 {
32 class AtomicString;
33 }
34 
35 namespace WebCore
36 {
37 
38 using khtml::AtomicString;
39 class SVGFontData;
40 
41 // Describe a SVG <glyph> element
42 struct SVGGlyphIdentifier {
43  enum Orientation {
44  Vertical,
45  Horizontal,
46  Both
47  };
48 
49  // SVG Font depends on exactly this order.
50  enum ArabicForm {
51  None = 0,
52  Isolated,
53  Terminal,
54  Initial,
55  Medial
56  };
57 
58  SVGGlyphIdentifier()
59  : isValid(false)
60  , orientation(Both)
61  , arabicForm(None)
62  , priority(0)
63  , nameLength(0)
64  , horizontalAdvanceX(0.0f)
65  , verticalOriginX(0.0f)
66  , verticalOriginY(0.0f)
67  , verticalAdvanceY(0.0f)
68  {
69  }
70 
71  // Used to mark our float properties as "to be inherited from SVGFontData"
72  static float inheritedValue()
73  {
74  static float s_inheritedValue = std::numeric_limits<float>::infinity();
75  return s_inheritedValue;
76  }
77 
78  bool operator==(const SVGGlyphIdentifier &other) const
79  {
80  return isValid == other.isValid &&
81  orientation == other.orientation &&
82  arabicForm == other.arabicForm &&
83  glyphName == other.glyphName &&
84  horizontalAdvanceX == other.horizontalAdvanceX &&
85  verticalOriginX == other.verticalOriginX &&
86  verticalOriginY == other.verticalOriginY &&
87  verticalAdvanceY == other.verticalAdvanceY &&
88  pathData.debugString() == other.pathData.debugString() &&
89  languages == other.languages;
90  }
91 
92  bool isValid : 1;
93 
94  Orientation orientation : 2;
95  ArabicForm arabicForm : 3;
96  int priority;
97  size_t nameLength;
98  String glyphName;
99 
100  float horizontalAdvanceX;
101  float verticalOriginX;
102  float verticalOriginY;
103  float verticalAdvanceY;
104 
105  Path pathData;
106  Vector<String> languages;
107 };
108 
109 class SVGGlyphElement : public SVGStyledElement
110 {
111 public:
112  SVGGlyphElement(const QualifiedName &, Document *);
113  virtual ~SVGGlyphElement();
114 
115  void insertedIntoDocument() override;
116  void removedFromDocument() override;
117 
118  bool rendererIsNeeded(RenderStyle *) override
119  {
120  return false;
121  }
122 
123  SVGGlyphIdentifier buildGlyphIdentifier() const;
124 
125  // Helper function used by SVGFont
126  static void inheritUnspecifiedAttributes(SVGGlyphIdentifier &, const SVGFontData *);
127  static String querySVGFontLanguage(const SVGElement *);
128 
129  // Helper function shared between SVGGlyphElement & SVGMissingGlyphElement
130  static SVGGlyphIdentifier buildGenericGlyphIdentifier(const SVGElement *);
131 };
132 
133 } // namespace WebCore
134 
135 #endif // ENABLE(SVG_FONTS)
136 #endif
This file is part of the HTML rendering engine for KDE.
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
bool isValid(QStringView ifopt)
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.