KHTML
SVGHKernElement.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2007 Eric Seidel <eric@webkit.org> 00003 Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 00004 Copyright (C) 2008 Eric Seidel <eric@webkit.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #include "config.h" 00023 #include "wtf/Platform.h" 00024 00025 #if ENABLE(SVG_FONTS) 00026 #include "SVGHKernElement.h" 00027 00028 #include "SVGFontElement.h" 00029 //FIXME khtml #include "SVGFontFaceElement.h" 00030 #include "SVGFontData.h" 00031 #include "SVGNames.h" 00032 #include "SVGParserUtilities.h" 00033 //FIXME khtml #include "SimpleFontData.h" 00034 00035 00036 namespace WebCore { 00037 00038 using namespace SVGNames; 00039 00040 SVGHKernElement::SVGHKernElement(const QualifiedName& tagName, Document* doc) 00041 : SVGElement(tagName, doc) 00042 { 00043 } 00044 00045 SVGHKernElement::~SVGHKernElement() 00046 { 00047 } 00048 00049 void SVGHKernElement::insertedIntoDocument() 00050 { 00051 Node* fontNode = parentNode(); 00052 if (fontNode && fontNode->hasTagName(fontTag)) { 00053 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 00054 element->invalidateGlyphCache(); 00055 } 00056 } 00057 00058 void SVGHKernElement::removedFromDocument() 00059 { 00060 Node* fontNode = parentNode(); 00061 if (fontNode && fontNode->hasTagName(fontTag)) { 00062 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 00063 element->invalidateGlyphCache(); 00064 } 00065 } 00066 00067 SVGHorizontalKerningPair SVGHKernElement::buildHorizontalKerningPair() const 00068 { 00069 SVGHorizontalKerningPair kerningPair; 00070 00071 kerningPair.unicode1 = getAttribute(u1Attr); 00072 kerningPair.glyphName1 = getAttribute(g1Attr); 00073 kerningPair.unicode2 = getAttribute(u2Attr); 00074 kerningPair.glyphName2 = getAttribute(g2Attr); 00075 kerningPair.kerning = getAttribute(kAttr).string().toDouble(); 00076 00077 return kerningPair; 00078 } 00079 00080 } 00081 00082 #endif // ENABLE(SVG_FONTS)
KDE 4.6 API Reference