Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cxfa_fontmgr.cpp
Go to the documentation of this file.
1
// Copyright 2014 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
"xfa/fxfa/cxfa_fontmgr.h"
8
9
#
include
"core/fpdfapi/parser/cpdf_dictionary.h"
10
#
include
"core/fxge/cfx_fontmgr.h"
11
#
include
"core/fxge/cfx_gemodule.h"
12
#
include
"xfa/fgas/font/cfgas_defaultfontmanager.h"
13
#
include
"xfa/fgas/font/cfgas_gefont.h"
14
#
include
"xfa/fgas/font/fgas_fontutils.h"
15
#
include
"xfa/fxfa/cxfa_ffapp.h"
16
#
include
"xfa/fxfa/cxfa_ffdoc.h"
17
18
CXFA_FontMgr::CXFA_FontMgr() =
default
;
19
20
CXFA_FontMgr::~
CXFA_FontMgr
() =
default
;
21
22
void
CXFA_FontMgr::
Trace
(cppgc::Visitor* visitor)
const
{}
23
24
RetainPtr
<CFGAS_GEFont> CXFA_FontMgr::
GetFont
(
CXFA_FFDoc
* pDoc,
25
const
WideString
& wsFontFamily,
26
uint32_t dwFontStyles) {
27
auto
key =
std
::make_pair(wsFontFamily, dwFontStyles);
28
auto
iter = m_FontMap.find(key);
29
if
(iter != m_FontMap.end())
30
return
iter->second;
31
32
WideString
wsEnglishName =
FGAS_FontNameToEnglishName
(
wsFontFamily
)
;
33
RetainPtr
<CFGAS_GEFont> pFont =
34
pDoc->GetPDFFont(wsEnglishName, dwFontStyles,
true
);
35
if
(pFont)
36
return
pFont;
37
38
pFont =
CFGAS_DefaultFontManager
::
GetFont
(wsFontFamily, dwFontStyles);
39
if
(!pFont) {
40
pFont = pDoc
->
GetPDFFont
(wsEnglishName, dwFontStyles,
false
);
41
if
(pFont)
42
return
pFont;
43
}
44
if
(!pFont) {
45
pFont =
CFGAS_DefaultFontManager
::
GetDefaultFont
(dwFontStyles);
46
}
47
if
(!pFont) {
48
pFont = CFGAS_GEFont
::
LoadStockFont
(
49
pDoc
->
GetPDFDoc
(
)
,
ByteString
::
Format
(
"%ls"
,
wsFontFamily.c_str()
)
)
;
50
}
51
if
(!pFont)
52
return
nullptr
;
53
54
m_FontMap[key] = pFont;
55
return
pFont;
56
}
ByteString
fxcrt::ByteString ByteString
Definition
bytestring.h:180
CFGAS_DefaultFontManager
Definition
cfgas_defaultfontmanager.h:15
CFGAS_DefaultFontManager::GetDefaultFont
static RetainPtr< CFGAS_GEFont > GetDefaultFont(uint32_t dwFontStyles)
Definition
cfgas_defaultfontmanager.cpp:62
CFGAS_DefaultFontManager::GetFont
static RetainPtr< CFGAS_GEFont > GetFont(WideString wsFontName, uint32_t dwFontStyles)
Definition
cfgas_defaultfontmanager.cpp:19
CFGAS_GEFont::LoadStockFont
static RetainPtr< CFGAS_GEFont > LoadStockFont(CPDF_Document *pDoc, const ByteString &font_family)
Definition
cfgas_gefont.cpp:58
CXFA_FFDoc
Definition
cxfa_ffdoc.h:55
CXFA_FFDoc::GetPDFDoc
CPDF_Document * GetPDFDoc() const
Definition
cxfa_ffdoc.h:169
CXFA_FFDoc::GetPDFFont
RetainPtr< CFGAS_GEFont > GetPDFFont(const WideString &family, uint32_t styles, bool strict)
Definition
cxfa_ffdoc.cpp:268
CXFA_FontMgr::~CXFA_FontMgr
~CXFA_FontMgr()
CXFA_FontMgr::Trace
void Trace(cppgc::Visitor *visitor) const
Definition
cxfa_fontmgr.cpp:22
CXFA_FontMgr::GetFont
RetainPtr< CFGAS_GEFont > GetFont(CXFA_FFDoc *hDoc, const WideString &wsFontFamily, uint32_t dwFontStyles)
Definition
cxfa_fontmgr.cpp:24
fxcrt::ByteString::Format
static ByteString Format(const char *pFormat,...)
Definition
bytestring.cpp:79
fxcrt::RetainPtr
Definition
retain_ptr.h:28
FGAS_FontNameToEnglishName
WideString FGAS_FontNameToEnglishName(const WideString &wsLocalName)
Definition
fgas_fontutils.cpp:2450
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
WideString
fxcrt::WideString WideString
Definition
widestring.h:207
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
cxfa_fontmgr.cpp
Generated on
for Qt by
1.18.0