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 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 void SVGFontElement::ensureGlyphCache() | 118 void SVGFontElement::ensureGlyphCache() |
119 { | 119 { |
120 if (m_isGlyphCacheValid) | 120 if (m_isGlyphCacheValid) |
121 return; | 121 return; |
122 | 122 |
123 SVGMissingGlyphElement* firstMissingGlyphElement = 0; | 123 SVGMissingGlyphElement* firstMissingGlyphElement = 0; |
124 Vector<String> ligatures; | 124 Vector<String> ligatures; |
125 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 125 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
126 if (child->hasTagName(SVGNames::glyphTag)) { | 126 if (child->hasTagName(SVGNames::glyphTag)) { |
127 SVGGlyphElement* glyph = static_cast<SVGGlyphElement*>(child); | 127 SVGGlyphElement* glyph = toSVGGlyphElement(child); |
128 AtomicString unicode = glyph->fastGetAttribute(SVGNames::unicodeAttr
); | 128 AtomicString unicode = glyph->fastGetAttribute(SVGNames::unicodeAttr
); |
129 AtomicString glyphId = glyph->getIdAttribute(); | 129 AtomicString glyphId = glyph->getIdAttribute(); |
130 if (glyphId.isEmpty() && unicode.isEmpty()) | 130 if (glyphId.isEmpty() && unicode.isEmpty()) |
131 continue; | 131 continue; |
132 | 132 |
133 m_glyphMap.addGlyph(glyphId, unicode, glyph->buildGlyphIdentifier())
; | 133 m_glyphMap.addGlyph(glyphId, unicode, glyph->buildGlyphIdentifier())
; |
134 | 134 |
135 // Register ligatures, if needed, don't mix up with surrogate pairs
though! | 135 // Register ligatures, if needed, don't mix up with surrogate pairs
though! |
136 if (unicode.length() > 1 && !U16_IS_SURROGATE(unicode[0])) | 136 if (unicode.length() > 1 && !U16_IS_SURROGATE(unicode[0])) |
137 ligatures.append(unicode.string()); | 137 ligatures.append(unicode.string()); |
138 } else if (child->hasTagName(SVGNames::hkernTag)) { | 138 } else if (child->hasTagName(SVGNames::hkernTag)) { |
139 SVGHKernElement* hkern = static_cast<SVGHKernElement*>(child); | 139 toSVGHKernElement(child)->buildHorizontalKerningPair(m_horizontalKer
ningPairs); |
140 hkern->buildHorizontalKerningPair(m_horizontalKerningPairs); | |
141 } else if (child->hasTagName(SVGNames::vkernTag)) { | 140 } else if (child->hasTagName(SVGNames::vkernTag)) { |
142 SVGVKernElement* vkern = static_cast<SVGVKernElement*>(child); | 141 toSVGVKernElement(child)->buildVerticalKerningPair(m_verticalKerning
Pairs); |
143 vkern->buildVerticalKerningPair(m_verticalKerningPairs); | |
144 } else if (child->hasTagName(SVGNames::missing_glyphTag) && !firstMissin
gGlyphElement) { | 142 } else if (child->hasTagName(SVGNames::missing_glyphTag) && !firstMissin
gGlyphElement) { |
145 firstMissingGlyphElement = toSVGMissingGlyphElement(child); | 143 firstMissingGlyphElement = toSVGMissingGlyphElement(child); |
146 } | 144 } |
147 } | 145 } |
148 | 146 |
149 // Register each character of each ligature, if needed. | 147 // Register each character of each ligature, if needed. |
150 if (!ligatures.isEmpty()) | 148 if (!ligatures.isEmpty()) |
151 registerLigaturesInGlyphCache(ligatures); | 149 registerLigaturesInGlyphCache(ligatures); |
152 | 150 |
153 // Register missing-glyph element, if present. | 151 // Register missing-glyph element, if present. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 252 |
255 Glyph SVGFontElement::missingGlyph() | 253 Glyph SVGFontElement::missingGlyph() |
256 { | 254 { |
257 ensureGlyphCache(); | 255 ensureGlyphCache(); |
258 return m_missingGlyph; | 256 return m_missingGlyph; |
259 } | 257 } |
260 | 258 |
261 } | 259 } |
262 | 260 |
263 #endif // ENABLE(SVG_FONTS) | 261 #endif // ENABLE(SVG_FONTS) |
OLD | NEW |