• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef SVGFontData_h
21 #define SVGFontData_h
22 
23 #if ENABLE(SVG_FONTS)
24 #include "SVGFontFaceElement.h"
25 
26 namespace WebCore {
27 
28 class SVGFontData {
29     WTF_MAKE_NONCOPYABLE(SVGFontData); WTF_MAKE_FAST_ALLOCATED;
30 public:
31     SVGFontData(SVGFontFaceElement*);
~SVGFontData()32     virtual ~SVGFontData() { }
33 
svgFontFaceElement()34     SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
35 
horizontalOriginX()36     float horizontalOriginX() const { return m_horizontalOriginX; }
horizontalOriginY()37     float horizontalOriginY() const { return m_horizontalOriginY; }
horizontalAdvanceX()38     float horizontalAdvanceX() const { return m_horizontalAdvanceX; }
39 
verticalOriginX()40     float verticalOriginX() const { return m_verticalOriginX; }
verticalOriginY()41     float verticalOriginY() const { return m_verticalOriginY; }
verticalAdvanceY()42     float verticalAdvanceY() const { return m_verticalAdvanceY; }
43 
44 private:
45     // Ths SVGFontFaceElement is kept alive --
46     // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document
47     //    containing the element;
48     // 2) in the in-document font case: by virtue of being in the document tree and making sure that when it is removed
49     //    from the document, it removes the @font-face rule it owns from the document's mapped element sheet and forces
50     //    a style update.
51     SVGFontFaceElement* m_svgFontFaceElement;
52 
53     float m_horizontalOriginX;
54     float m_horizontalOriginY;
55     float m_horizontalAdvanceX;
56 
57     float m_verticalOriginX;
58     float m_verticalOriginY;
59     float m_verticalAdvanceY;
60 };
61 
62 } // namespace WebCore
63 
64 #endif
65 #endif // SVGFontData_h
66