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 && fontNode->hasTagName(SVGNames::fontTag)) |
48 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) | 48 toSVGFontElement(fontNode)->invalidateGlyphCache(); |
49 element->invalidateGlyphCache(); | |
50 } | |
51 | 49 |
52 return SVGElement::insertedInto(rootParent); | 50 return SVGElement::insertedInto(rootParent); |
53 } | 51 } |
54 | 52 |
55 void SVGHKernElement::removedFrom(ContainerNode* rootParent) | 53 void SVGHKernElement::removedFrom(ContainerNode* rootParent) |
56 { | 54 { |
57 ContainerNode* fontNode = parentNode(); | 55 ContainerNode* fontNode = parentNode(); |
58 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) { | 56 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) |
59 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) | 57 toSVGFontElement(fontNode)->invalidateGlyphCache(); |
60 element->invalidateGlyphCache(); | |
61 } | |
62 | 58 |
63 SVGElement::removedFrom(rootParent); | 59 SVGElement::removedFrom(rootParent); |
64 } | 60 } |
65 | 61 |
66 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs
) | 62 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs
) |
67 { | 63 { |
68 String u1 = fastGetAttribute(SVGNames::u1Attr); | 64 String u1 = fastGetAttribute(SVGNames::u1Attr); |
69 String g1 = fastGetAttribute(SVGNames::g1Attr); | 65 String g1 = fastGetAttribute(SVGNames::g1Attr); |
70 String u2 = fastGetAttribute(SVGNames::u2Attr); | 66 String u2 = fastGetAttribute(SVGNames::u2Attr); |
71 String g2 = fastGetAttribute(SVGNames::g2Attr); | 67 String g2 = fastGetAttribute(SVGNames::g2Attr); |
72 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) | 68 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) |
73 return; | 69 return; |
74 | 70 |
75 SVGKerningPair kerningPair; | 71 SVGKerningPair kerningPair; |
76 if (parseGlyphName(g1, kerningPair.glyphName1) | 72 if (parseGlyphName(g1, kerningPair.glyphName1) |
77 && parseGlyphName(g2, kerningPair.glyphName2) | 73 && parseGlyphName(g2, kerningPair.glyphName2) |
78 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) | 74 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) |
79 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { | 75 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { |
80 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); | 76 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); |
81 kerningPairs.append(kerningPair); | 77 kerningPairs.append(kerningPair); |
82 } | 78 } |
83 } | 79 } |
84 | 80 |
85 } | 81 } |
86 | 82 |
87 #endif // ENABLE(SVG_FONTS) | 83 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |