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 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 PassRefPtr<SVGHKernElement> SVGHKernElement::create(Document& document) | 36 PassRefPtr<SVGHKernElement> SVGHKernElement::create(Document& document) |
37 { | 37 { |
38 return adoptRef(new SVGHKernElement(document)); | 38 return adoptRef(new SVGHKernElement(document)); |
39 } | 39 } |
40 | 40 |
41 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode*
rootParent) | 41 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode*
rootParent) |
42 { | 42 { |
43 ContainerNode* fontNode = parentNode(); | 43 ContainerNode* fontNode = parentNode(); |
44 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) | 44 if (isSVGFontElement(fontNode)) |
45 toSVGFontElement(fontNode)->invalidateGlyphCache(); | 45 toSVGFontElement(*fontNode).invalidateGlyphCache(); |
46 | 46 |
47 return SVGElement::insertedInto(rootParent); | 47 return SVGElement::insertedInto(rootParent); |
48 } | 48 } |
49 | 49 |
50 void SVGHKernElement::removedFrom(ContainerNode* rootParent) | 50 void SVGHKernElement::removedFrom(ContainerNode* rootParent) |
51 { | 51 { |
52 ContainerNode* fontNode = parentNode(); | 52 ContainerNode* fontNode = parentNode(); |
53 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) | 53 if (isSVGFontElement(fontNode)) |
54 toSVGFontElement(fontNode)->invalidateGlyphCache(); | 54 toSVGFontElement(*fontNode).invalidateGlyphCache(); |
55 | 55 |
56 SVGElement::removedFrom(rootParent); | 56 SVGElement::removedFrom(rootParent); |
57 } | 57 } |
58 | 58 |
59 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs
) | 59 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs
) |
60 { | 60 { |
61 String u1 = fastGetAttribute(SVGNames::u1Attr); | 61 String u1 = fastGetAttribute(SVGNames::u1Attr); |
62 String g1 = fastGetAttribute(SVGNames::g1Attr); | 62 String g1 = fastGetAttribute(SVGNames::g1Attr); |
63 String u2 = fastGetAttribute(SVGNames::u2Attr); | 63 String u2 = fastGetAttribute(SVGNames::u2Attr); |
64 String g2 = fastGetAttribute(SVGNames::g2Attr); | 64 String g2 = fastGetAttribute(SVGNames::g2Attr); |
65 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) | 65 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) |
66 return; | 66 return; |
67 | 67 |
68 SVGKerningPair kerningPair; | 68 SVGKerningPair kerningPair; |
69 if (parseGlyphName(g1, kerningPair.glyphName1) | 69 if (parseGlyphName(g1, kerningPair.glyphName1) |
70 && parseGlyphName(g2, kerningPair.glyphName2) | 70 && parseGlyphName(g2, kerningPair.glyphName2) |
71 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) | 71 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) |
72 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { | 72 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { |
73 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); | 73 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); |
74 kerningPairs.append(kerningPair); | 74 kerningPairs.append(kerningPair); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 } | 78 } |
79 | 79 |
80 #endif // ENABLE(SVG_FONTS) | 80 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |