OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 GlyphData glyphData = pair.first; | 181 GlyphData glyphData = pair.first; |
182 | 182 |
183 // Check if we have the missing glyph data, in which case we can just return
. | 183 // Check if we have the missing glyph data, in which case we can just return
. |
184 GlyphData missingGlyphData = primaryFont->missingGlyphData(); | 184 GlyphData missingGlyphData = primaryFont->missingGlyphData(); |
185 if (glyphData.glyph == missingGlyphData.glyph && glyphData.fontData == missi
ngGlyphData.fontData) { | 185 if (glyphData.glyph == missingGlyphData.glyph && glyphData.fontData == missi
ngGlyphData.fontData) { |
186 ASSERT(glyphData.fontData); | 186 ASSERT(glyphData.fontData); |
187 return glyphData; | 187 return glyphData; |
188 } | 188 } |
189 | 189 |
190 // Characters enclosed by an <altGlyph> element, may not be registered in th
e GlyphPage. | 190 // Characters enclosed by an <altGlyph> element, may not be registered in th
e GlyphPage. |
| 191 const SimpleFontData* originalFontData = glyphData.fontData; |
191 if (glyphData.fontData && !glyphData.fontData->isSVGFont()) { | 192 if (glyphData.fontData && !glyphData.fontData->isSVGFont()) { |
192 if (TextRun::RenderingContext* renderingContext = run.renderingContext()
) { | 193 if (TextRun::RenderingContext* renderingContext = run.renderingContext()
) { |
193 RenderObject* renderObject = static_cast<SVGTextRunRenderingContext*
>(renderingContext)->renderer(); | 194 RenderObject* renderObject = static_cast<SVGTextRunRenderingContext*
>(renderingContext)->renderer(); |
194 RenderObject* parentRenderObject = renderObject->isText() ? renderOb
ject->parent() : renderObject; | 195 RenderObject* parentRenderObject = renderObject->isText() ? renderOb
ject->parent() : renderObject; |
195 ASSERT(parentRenderObject); | 196 ASSERT(parentRenderObject); |
196 if (Element* parentRenderObjectElement = toElement(parentRenderObjec
t->node())) { | 197 if (Element* parentRenderObjectElement = toElement(parentRenderObjec
t->node())) { |
197 if (parentRenderObjectElement->hasTagName(SVGNames::altGlyphTag)
) | 198 if (parentRenderObjectElement->hasTagName(SVGNames::altGlyphTag)
) |
198 glyphData.fontData = primaryFont; | 199 glyphData.fontData = primaryFont; |
199 } | 200 } |
200 } | 201 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 GlyphPageTreeNode* originalGlyphPageZero = fontList->glyphPageZero(); | 233 GlyphPageTreeNode* originalGlyphPageZero = fontList->glyphPageZero(); |
233 const FontFallbackList::GlyphPages& originalGlyphPages = fontList->glyphPage
s(); | 234 const FontFallbackList::GlyphPages& originalGlyphPages = fontList->glyphPage
s(); |
234 page->setGlyphDataForCharacter(character, glyphData.glyph, 0); | 235 page->setGlyphDataForCharacter(character, glyphData.glyph, 0); |
235 | 236 |
236 // Assure that the font fallback glyph selection worked, aka. the fallbackGl
yphData font data is not the same as before. | 237 // Assure that the font fallback glyph selection worked, aka. the fallbackGl
yphData font data is not the same as before. |
237 GlyphData fallbackGlyphData = font.glyphDataForCharacter(character, mirror); | 238 GlyphData fallbackGlyphData = font.glyphDataForCharacter(character, mirror); |
238 ASSERT(fallbackGlyphData.fontData != fontData); | 239 ASSERT(fallbackGlyphData.fontData != fontData); |
239 | 240 |
240 // Restore original state of the SVG Font glyph table and the current font f
allback list, | 241 // Restore original state of the SVG Font glyph table and the current font f
allback list, |
241 // to assure the next lookup of the same glyph won't immediately return the
fallback glyph. | 242 // to assure the next lookup of the same glyph won't immediately return the
fallback glyph. |
242 page->setGlyphDataForCharacter(character, glyphData.glyph, fontData); | 243 page->setGlyphDataForCharacter(character, glyphData.glyph, originalFontData)
; |
243 fontList->setGlyphPageZero(originalGlyphPageZero); | 244 fontList->setGlyphPageZero(originalGlyphPageZero); |
244 fontList->setGlyphPages(originalGlyphPages); | 245 fontList->setGlyphPages(originalGlyphPages); |
245 ASSERT(fallbackGlyphData.fontData); | 246 ASSERT(fallbackGlyphData.fontData); |
246 return fallbackGlyphData; | 247 return fallbackGlyphData; |
247 } | 248 } |
248 | 249 |
249 } | 250 } |
250 | 251 |
251 #endif | 252 #endif |
OLD | NEW |