+void GlyphCacheManager::RemoveGlyphFromFace(const FT_Face freeTypeFace)
+{
+ uint32_t removedItemCount = 0;
+
+ auto endIter = mLRUGlyphCache.End();
+ for(auto iter = mLRUGlyphCache.Begin(); iter != endIter;)
+ {
+ // Check whether this cached item has inputed freeTypeFace as key.
+ auto keyFace = mLRUGlyphCache.GetKey(iter).mFreeTypeFace;
+ if(keyFace == freeTypeFace)
+ {
+ ++removedItemCount;
+ iter = mLRUGlyphCache.Erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+
+ DALI_LOG_INFO(gFontClientLogFilter, Debug::Verbose, "FontClient::Plugin::GlyphCacheManager::RemoveGlyphFromFace. Remove all cached glyph with face : %p, removed glyph count : %u\n", freeTypeFace, removedItemCount);
+}
+
+void GlyphCacheManager::ClearCache(const std::size_t remainCount)
+{
+ if(remainCount == 0u)
+ {
+ // Release all data memory first.
+ auto endIter = mLRUGlyphCache.End();
+ for(auto iter = mLRUGlyphCache.Begin(); iter != endIter; ++iter)
+ {
+ // Get the reference of data. and release it.
+ auto& removedData = mLRUGlyphCache.GetElement(iter);
+ removedData.ReleaseGlyphData();
+ }
+
+ // Clear all cache.
+ mLRUGlyphCache.Clear();
+ }
+ else
+ {
+ // While the cache count is bigger than remainCount, remove oldest glyph.
+ while(mLRUGlyphCache.Count() > remainCount)
+ {
+ auto removedData = mLRUGlyphCache.Pop();
+
+ DALI_LOG_INFO(gFontClientLogFilter, Debug::Verbose, "FontClient::Plugin::GlyphCacheManager::ClearCache[%zu / %zu]. Remove oldest cache for glyph : %p\n", mLRUGlyphCache.Count(), remainCount, removedData.mGlyph);
+
+ // Release Glyph data resource
+ removedData.ReleaseGlyphData();
+ }
+ }
+}
+