| 39 | } |
| 40 | |
| 41 | void Font::ClearGlyphCache() |
| 42 | { |
| 43 | if (m_atlas) |
| 44 | { |
| 45 | if (m_atlas.unique()) |
| 46 | m_atlas->Clear(); // Appellera OnAtlasCleared |
| 47 | else |
| 48 | { |
| 49 | // Au moins une autre police utilise cet atlas, on vire nos glyphes un par un |
| 50 | for (auto mapIt = m_glyphes.begin(); mapIt != m_glyphes.end(); ++mapIt) |
| 51 | { |
| 52 | GlyphMap& glyphMap = mapIt->second; |
| 53 | for (auto glyphIt = glyphMap.begin(); glyphIt != glyphMap.end(); ++glyphIt) |
| 54 | { |
| 55 | Glyph& glyph = glyphIt->second; |
| 56 | m_atlas->Free(&glyph.atlasRect, &glyph.layerIndex, 1); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Destruction des glyphes mémorisés et notification |
| 61 | m_glyphes.clear(); |
| 62 | |
| 63 | OnFontGlyphCacheCleared(this); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | void Font::ClearKerningCache() |
| 69 | { |