fwRefContainer<CachedFont> FontRendererImpl::GetFontInstance(ComPtr<IDWriteFontFace> fontFace, float emSize) { auto key = GetFontKey(fontFace, emSize); auto it = m_fontCache.find(key); if (it != m_fontCache.end()) { return it->second; } fwRefContainer<CachedFont> cachedFont = new CachedFont(fontFace, emSize); m_fontCache[key] = cachedFont; return cachedFont; }
std::shared_ptr<CachedFont> FontRendererImpl::GetFontInstance(ComPtr<IDWriteFontFace> fontFace, float emSize) { auto key = GetFontKey(fontFace, emSize); auto it = m_fontCache.find(key); if (it != m_fontCache.end()) { return it->second; } auto cachedFont = std::make_shared<CachedFont>(fontFace, emSize); m_fontCache[key] = cachedFont; return cachedFont; }