File indexing completed on 2024-04-28 15:24:33

0001 /*
0002    Copyright (C) 2007 Eric Seidel <eric@webkit.org>
0003    Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef SVGFontFaceElement_h
0022 #define SVGFontFaceElement_h
0023 
0024 #if ENABLE(SVG_FONTS)
0025 #include "SVGElement.h"
0026 
0027 namespace WebCore
0028 {
0029 
0030 class CSSFontFaceRule;
0031 class CSSMutableStyleDeclaration;
0032 class SVGFontElement;
0033 
0034 class SVGFontFaceElement : public SVGElement
0035 {
0036 public:
0037     SVGFontFaceElement(const QualifiedName &, Document *);
0038     virtual ~SVGFontFaceElement();
0039 
0040     virtual void parseMappedAttribute(MappedAttribute *);
0041 
0042     virtual void childrenChanged(bool changedByParser = false, Node *beforeChange = 0, Node *afterChange = 0, int childCountDelta = 0);
0043     virtual void insertedIntoDocument();
0044 
0045     unsigned unitsPerEm() const;
0046     int xHeight() const;
0047     float horizontalOriginX() const;
0048     float horizontalOriginY() const;
0049     float horizontalAdvanceX() const;
0050     float verticalOriginX() const;
0051     float verticalOriginY() const;
0052     float verticalAdvanceY() const;
0053     int ascent() const;
0054     int descent() const;
0055     String fontFamily() const;
0056 
0057     SVGFontElement *associatedFontElement() const;
0058     void rebuildFontFace();
0059 
0060 private:
0061     RefPtr<CSSFontFaceRule> m_fontFaceRule;
0062     RefPtr<CSSMutableStyleDeclaration> m_styleDeclaration;
0063 
0064     RefPtr<SVGFontElement> m_fontElement;
0065 };
0066 
0067 } // namespace WebCore
0068 
0069 #endif // ENABLE(SVG_FONTS)
0070 #endif
0071