KHTML
SVGHKernElement.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00030 #include "SVGFontData.h"
00031 #include "SVGNames.h"
00032 #include "SVGParserUtilities.h"
00033
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)