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_gemodule.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_gemodule.h"
8
9#include "core/fxge/cfx_folderfontinfo.h"
10#include "core/fxge/cfx_fontcache.h"
11#include "core/fxge/cfx_fontmgr.h"
12#include "third_party/base/check.h"
13
14namespace {
15
16CFX_GEModule* g_pGEModule = nullptr;
17
18} // namespace
19
20CFX_GEModule::CFX_GEModule(const char** pUserFontPaths)
21 : m_pPlatform(PlatformIface::Create()),
22 m_pFontMgr(std::make_unique<CFX_FontMgr>()),
23 m_pFontCache(std::make_unique<CFX_FontCache>()),
24 m_pUserFontPaths(pUserFontPaths) {}
25
26CFX_GEModule::~CFX_GEModule() = default;
27
28// static
29void CFX_GEModule::Create(const char** pUserFontPaths) {
30 DCHECK(!g_pGEModule);
31 g_pGEModule = new CFX_GEModule(pUserFontPaths);
32 g_pGEModule->m_pPlatform->Init();
33 g_pGEModule->GetFontMgr()->GetBuiltinMapper()->SetSystemFontInfo(
34 g_pGEModule->m_pPlatform->CreateDefaultSystemFontInfo());
35}
36
37// static
39 DCHECK(g_pGEModule);
40 delete g_pGEModule;
41 g_pGEModule = nullptr;
42}
43
44// static
46 DCHECK(g_pGEModule);
47 return g_pGEModule;
48}
CFX_FontMapper * GetBuiltinMapper() const
Definition cfx_fontmgr.h:71
static CFX_GEModule * Get()
static void Create(const char **pUserFontPaths)
CFX_FontMgr * GetFontMgr() const
static void Destroy()