OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 PassRefPtr<SVGHKernElement> SVGHKernElement::create(const QualifiedName& tagName
, Document* document) | 39 PassRefPtr<SVGHKernElement> SVGHKernElement::create(const QualifiedName& tagName
, Document* document) |
40 { | 40 { |
41 return adoptRef(new SVGHKernElement(tagName, document)); | 41 return adoptRef(new SVGHKernElement(tagName, document)); |
42 } | 42 } |
43 | 43 |
44 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode*
rootParent) | 44 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode*
rootParent) |
45 { | 45 { |
46 ContainerNode* fontNode = parentNode(); | 46 ContainerNode* fontNode = parentNode(); |
47 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) | 47 if (fontNode && isSVGFontElement(fontNode)) |
48 toSVGFontElement(fontNode)->invalidateGlyphCache(); | 48 toSVGFontElement(fontNode)->invalidateGlyphCache(); |
49 | 49 |
50 return SVGElement::insertedInto(rootParent); | 50 return SVGElement::insertedInto(rootParent); |
51 } | 51 } |
52 | 52 |
53 void SVGHKernElement::removedFrom(ContainerNode* rootParent) | 53 void SVGHKernElement::removedFrom(ContainerNode* rootParent) |
54 { | 54 { |
55 ContainerNode* fontNode = parentNode(); | 55 ContainerNode* fontNode = parentNode(); |
56 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) | 56 if (fontNode && isSVGFontElement(fontNode)) |
57 toSVGFontElement(fontNode)->invalidateGlyphCache(); | 57 toSVGFontElement(fontNode)->invalidateGlyphCache(); |
58 | 58 |
59 SVGElement::removedFrom(rootParent); | 59 SVGElement::removedFrom(rootParent); |
60 } | 60 } |
61 | 61 |
62 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs
) | 62 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs
) |
63 { | 63 { |
64 String u1 = fastGetAttribute(SVGNames::u1Attr); | 64 String u1 = fastGetAttribute(SVGNames::u1Attr); |
65 String g1 = fastGetAttribute(SVGNames::g1Attr); | 65 String g1 = fastGetAttribute(SVGNames::g1Attr); |
66 String u2 = fastGetAttribute(SVGNames::u2Attr); | 66 String u2 = fastGetAttribute(SVGNames::u2Attr); |
67 String g2 = fastGetAttribute(SVGNames::g2Attr); | 67 String g2 = fastGetAttribute(SVGNames::g2Attr); |
68 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) | 68 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) |
69 return; | 69 return; |
70 | 70 |
71 SVGKerningPair kerningPair; | 71 SVGKerningPair kerningPair; |
72 if (parseGlyphName(g1, kerningPair.glyphName1) | 72 if (parseGlyphName(g1, kerningPair.glyphName1) |
73 && parseGlyphName(g2, kerningPair.glyphName2) | 73 && parseGlyphName(g2, kerningPair.glyphName2) |
74 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) | 74 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) |
75 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { | 75 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { |
76 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); | 76 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); |
77 kerningPairs.append(kerningPair); | 77 kerningPairs.append(kerningPair); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 } | 81 } |
82 | 82 |
83 #endif // ENABLE(SVG_FONTS) | 83 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |