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
cfx_androidfontinfo.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/android/cfx_androidfontinfo.h"
8
9
#
include
"core/fxcrt/fx_system.h"
10
#
include
"core/fxge/android/cfpf_skiafont.h"
11
#
include
"core/fxge/android/cfpf_skiafontmgr.h"
12
#
include
"core/fxge/cfx_fontmapper.h"
13
#
include
"core/fxge/fx_font.h"
14
15
CFX_AndroidFontInfo::
CFX_AndroidFontInfo
() =
default
;
16
17
CFX_AndroidFontInfo::~
CFX_AndroidFontInfo
() =
default
;
18
19
bool
CFX_AndroidFontInfo::
Init
(
CFPF_SkiaFontMgr
* pFontMgr,
20
const
char
** user_paths) {
21
if
(!pFontMgr) {
22
return
false
;
23
}
24
25
m_pFontMgr = pFontMgr;
26
m_pFontMgr->LoadFonts(user_paths);
27
return
true
;
28
}
29
30
bool
CFX_AndroidFontInfo::
EnumFontList
(
CFX_FontMapper
* pMapper) {
31
return
false
;
32
}
33
34
void
* CFX_AndroidFontInfo::
MapFont
(
int
weight,
35
bool
bItalic,
36
FX_Charset
charset,
37
int
pitch_family,
38
const
ByteString
& face) {
39
if
(!m_pFontMgr)
40
return
nullptr
;
41
42
uint32_t dwStyle = 0;
43
if
(weight >= 700)
44
dwStyle |=
FXFONT_FORCE_BOLD
;
45
if
(bItalic)
46
dwStyle |=
FXFONT_ITALIC
;
47
if
(
FontFamilyIsFixedPitch
(
pitch_family
)
)
48
dwStyle |=
FXFONT_FIXED_PITCH
;
49
if
(
FontFamilyIsScript
(
pitch_family
)
)
50
dwStyle |=
FXFONT_SCRIPT
;
51
if
(
FontFamilyIsRoman
(
pitch_family
)
)
52
dwStyle |=
FXFONT_SERIF
;
53
return
m_pFontMgr->CreateFont(face.AsStringView(), charset, dwStyle);
54
}
55
56
void
* CFX_AndroidFontInfo::
GetFont
(
const
ByteString
& face) {
57
return
nullptr
;
58
}
59
60
size_t
CFX_AndroidFontInfo::
GetFontData
(
void
* hFont,
61
uint32_t table,
62
pdfium::span<uint8_t> buffer) {
63
if
(!hFont)
64
return
0;
65
return
static_cast
<
CFPF_SkiaFont
*>(hFont)->GetFontData(table, buffer);
66
}
67
68
bool
CFX_AndroidFontInfo::
GetFaceName
(
void
* hFont,
ByteString
* name) {
69
if
(!hFont)
70
return
false
;
71
72
*name
=
static_cast
<
CFPF_SkiaFont
*>(hFont)
->
GetFamilyName
(
)
;
73
return
true
;
74
}
75
76
bool
CFX_AndroidFontInfo::
GetFontCharset
(
void
* hFont,
FX_Charset
* charset) {
77
if
(!hFont)
78
return
false
;
79
80
*charset =
static_cast
<
CFPF_SkiaFont
*>(hFont)
->
GetCharset
(
)
;
81
return
false
;
82
}
83
84
void
CFX_AndroidFontInfo::
DeleteFont
(
void
* hFont) {}
ByteString
fxcrt::ByteString ByteString
Definition
bytestring.h:180
CFPF_SkiaFontMgr
Definition
cfpf_skiafontmgr.h:23
CFPF_SkiaFont
Definition
cfpf_skiafont.h:22
CFPF_SkiaFont::GetCharset
FX_Charset GetCharset() const
Definition
cfpf_skiafont.h:32
CFPF_SkiaFont::GetFamilyName
ByteString GetFamilyName()
Definition
cfpf_skiafont.cpp:29
CFX_AndroidFontInfo::MapFont
void * MapFont(int weight, bool bItalic, FX_Charset charset, int pitch_family, const ByteString &face) override
Definition
cfx_androidfontinfo.cpp:34
CFX_AndroidFontInfo::GetFontCharset
bool GetFontCharset(void *hFont, FX_Charset *charset) override
Definition
cfx_androidfontinfo.cpp:76
CFX_AndroidFontInfo::~CFX_AndroidFontInfo
~CFX_AndroidFontInfo() override
CFX_AndroidFontInfo::DeleteFont
void DeleteFont(void *hFont) override
Definition
cfx_androidfontinfo.cpp:84
CFX_AndroidFontInfo::CFX_AndroidFontInfo
CFX_AndroidFontInfo()
CFX_AndroidFontInfo::Init
bool Init(CFPF_SkiaFontMgr *pFontMgr, const char **user_paths)
Definition
cfx_androidfontinfo.cpp:19
CFX_AndroidFontInfo::GetFaceName
bool GetFaceName(void *hFont, ByteString *name) override
Definition
cfx_androidfontinfo.cpp:68
CFX_AndroidFontInfo::GetFontData
size_t GetFontData(void *hFont, uint32_t table, pdfium::span< uint8_t > buffer) override
Definition
cfx_androidfontinfo.cpp:60
CFX_AndroidFontInfo::GetFont
void * GetFont(const ByteString &face) override
Definition
cfx_androidfontinfo.cpp:56
CFX_AndroidFontInfo::EnumFontList
bool EnumFontList(CFX_FontMapper *pMapper) override
Definition
cfx_androidfontinfo.cpp:30
CFX_FontMapper
Definition
cfx_fontmapper.h:31
fxcrt::ByteString::operator=
ByteString & operator=(ByteString &&that) noexcept
Definition
bytestring.cpp:175
FX_Charset
FX_Charset
Definition
fx_codepage.h:71
FontFamilyIsFixedPitch
bool FontFamilyIsFixedPitch(uint32_t family)
Definition
fx_font.h:86
FXFONT_SERIF
#define FXFONT_SERIF
Definition
fx_font.h:31
FontFamilyIsScript
bool FontFamilyIsScript(int32_t family)
Definition
fx_font.h:92
FXFONT_ITALIC
#define FXFONT_ITALIC
Definition
fx_font.h:35
FontFamilyIsRoman
bool FontFamilyIsRoman(uint32_t family)
Definition
fx_font.h:89
FXFONT_SCRIPT
#define FXFONT_SCRIPT
Definition
fx_font.h:33
FXFONT_FORCE_BOLD
#define FXFONT_FORCE_BOLD
Definition
fx_font.h:38
FXFONT_FIXED_PITCH
#define FXFONT_FIXED_PITCH
Definition
fx_font.h:30
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxge
android
cfx_androidfontinfo.cpp
Generated on
for Qt by
1.18.0