summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffapp.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffapp.h2
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp2
-rw-r--r--xfa/fxfa/cxfa_fontmgr.cpp13
-rw-r--r--xfa/fxfa/cxfa_fwltheme.cpp6
-rw-r--r--xfa/fxfa/cxfa_fwltheme.h2
6 files changed, 21 insertions, 8 deletions
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index a2b0c005f0..1367a77b87 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -51,10 +51,10 @@ CFGAS_FontMgr* CXFA_FFApp::GetFDEFontMgr() {
return m_pFDEFontMgr.get();
}
-CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() {
+CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme(CXFA_FFDoc* doc) {
if (!m_pFWLTheme) {
auto fwl_theme = pdfium::MakeUnique<CXFA_FWLTheme>(this);
- if (fwl_theme->LoadCalendarFont())
+ if (fwl_theme->LoadCalendarFont(doc))
m_pFWLTheme = std::move(fwl_theme);
}
return m_pFWLTheme.get();
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index 1b1b40a512..c43cb3e6b2 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -40,7 +40,7 @@ class CXFA_FFApp {
CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
CFGAS_FontMgr* GetFDEFontMgr();
- CXFA_FWLTheme* GetFWLTheme();
+ CXFA_FWLTheme* GetFWLTheme(CXFA_FFDoc* doc);
IXFA_AppProvider* GetAppProvider() const { return m_pProvider.Get(); }
const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index ce8e70ea0c..f1b8cffa8f 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -119,7 +119,7 @@ void CXFA_FFField::DrawFocus(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) {
void CXFA_FFField::SetFWLThemeProvider() {
if (m_pNormalWidget)
- m_pNormalWidget->SetThemeProvider(GetApp()->GetFWLTheme());
+ m_pNormalWidget->SetThemeProvider(GetApp()->GetFWLTheme(GetDoc()));
}
bool CXFA_FFField::IsLoaded() {
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 7770825b26..c35b10c9bc 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -13,6 +13,8 @@
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxge/cfx_fontmgr.h"
+#include "core/fxge/cfx_gemodule.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/font/fgas_fontutils.h"
@@ -55,11 +57,22 @@ RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
if (pFont)
return pFont;
}
+
if (!pFont) {
pFont = m_pDefFontMgr.GetDefaultFont(hDoc->GetApp()->GetFDEFontMgr(),
wsFontFamily, dwFontStyles);
}
+ if (!pFont) {
+ ByteString font_family =
+ ByteString::Format("%ls", WideString(wsFontFamily).c_str());
+ CPDF_Font* stock_font =
+ CPDF_Font::GetStockFont(hDoc->GetPDFDoc(), font_family.AsStringView());
+ if (stock_font)
+ pFont = CFGAS_GEFont::LoadFont(stock_font->GetFont(),
+ hDoc->GetApp()->GetFDEFontMgr());
+ }
+
if (pFont) {
if (pPDFFont) {
pMgr->SetFont(pFont, pPDFFont);
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index 94d963d70e..1a94ba6446 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -62,11 +62,11 @@ CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp)
m_Rect.Reset();
}
-bool CXFA_FWLTheme::LoadCalendarFont() {
+bool CXFA_FWLTheme::LoadCalendarFont(CXFA_FFDoc* doc) {
for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts);
++i) {
- m_pCalendarFont = CFGAS_GEFont::LoadFont(g_FWLTheme_CalFonts[i], 0, 0,
- m_pApp->GetFDEFontMgr());
+ m_pCalendarFont =
+ m_pApp->GetXFAFontMgr()->GetFont(doc, g_FWLTheme_CalFonts[i], 0);
}
if (!m_pCalendarFont) {
diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h
index 289bbd4fe5..31e29bf4eb 100644
--- a/xfa/fxfa/cxfa_fwltheme.h
+++ b/xfa/fxfa/cxfa_fwltheme.h
@@ -29,7 +29,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider {
explicit CXFA_FWLTheme(CXFA_FFApp* pApp);
~CXFA_FWLTheme() override;
- bool LoadCalendarFont();
+ bool LoadCalendarFont(CXFA_FFDoc* doc);
// IFWL_ThemeProvider:
void DrawBackground(CFWL_ThemeBackground* pParams) override;