SVGHKernElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG_FONTS)
#include "SVGHKernElement.h"
#include "SVGFontElement.h"
#include "SVGFontFaceElement.h"
#include "SVGFontData.h"
#include "SVGNames.h"
#include "SimpleFontData.h"
#include "XMLNames.h"
namespace WebCore {
using namespace SVGNames;
SVGHKernElement::SVGHKernElement(const QualifiedName& tagName, Document* doc)
: SVGElement(tagName, doc)
{
}
SVGHKernElement::~SVGHKernElement()
{
}
void SVGHKernElement::insertedIntoDocument()
{
Node* fontNode = parentNode();
if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
element->invalidateGlyphCache();
}
}
void SVGHKernElement::removedFromDocument()
{
Node* fontNode = parentNode();
if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode))
element->invalidateGlyphCache();
}
}
SVGHorizontalKerningPair SVGHKernElement::buildHorizontalKerningPair() const
{
SVGHorizontalKerningPair kerningPair;
parseGlyphName(getAttribute(g1Attr), kerningPair.glyphName1);
parseGlyphName(getAttribute(g2Attr), kerningPair.glyphName2);
parseKerningUnicodeString(getAttribute(u1Attr), kerningPair.unicodeRange1, kerningPair.unicodeName1);
parseKerningUnicodeString(getAttribute(u2Attr), kerningPair.unicodeRange2, kerningPair.unicodeName2);
kerningPair.kerning = getAttribute(kAttr).string().toFloat();
return kerningPair;
}
}
#endif // ENABLE(SVG_FONTS)