Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfx_fontcache.cpp
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "core/fxge/cfx_fontcache.h"
8
9#include "core/fxge/cfx_font.h"
10#include "core/fxge/cfx_glyphcache.h"
11#include "core/fxge/fx_font.h"
12
13CFX_FontCache::CFX_FontCache() = default;
14
15CFX_FontCache::~CFX_FontCache() = default;
16
17RetainPtr<CFX_GlyphCache> CFX_FontCache::GetGlyphCache(const CFX_Font* pFont) {
18 RetainPtr<CFX_Face> face = pFont->GetFace();
19 const bool bExternal = !face;
20 auto& map = bExternal ? m_ExtGlyphCacheMap : m_GlyphCacheMap;
21 auto it = map.find(face.Get());
22 if (it != map.end() && it->second)
23 return pdfium::WrapRetain(it->second.Get());
24
25 auto new_cache = pdfium::MakeRetain<CFX_GlyphCache>(face);
26 map[face.Get()].Reset(new_cache.Get());
27 return new_cache;
28}
29
30#if defined(PDF_USE_SKIA)
31CFX_TypeFace* CFX_FontCache::GetDeviceCache(const CFX_Font* pFont) {
32 return GetGlyphCache(pFont)->GetDeviceCache(pFont);
33}
34#endif
RetainPtr< CFX_GlyphCache > GetGlyphCache(const CFX_Font *pFont)