summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-02 22:39:16 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-02 22:39:16 +0000
commit4dbea51fc4bfdcc520dec2b949fd44ec8881cac9 (patch)
tree7b79a1f13b38bf16b4db29ede0d82b2d6a7a183a /xfa
parentc0a3a9b72f9bddd0b0a2b0465d961c6d9584558b (diff)
downloadpdfium-4dbea51fc4bfdcc520dec2b949fd44ec8881cac9.tar.xz
Reduce includes in cfgas_defaultfontmanager.h
Do IWYU elsewhere, and unindent CFGAS_DefaultFontManager::GetFont(). Change-Id: Idb06c4ae75ce2d72b231cc4c84f61e5ca8a80cc5 Reviewed-on: https://pdfium-review.googlesource.com/c/43314 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/font/cfgas_defaultfontmanager.cpp55
-rw-r--r--xfa/fgas/font/cfgas_defaultfontmanager.h4
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp2
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp1
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp1
5 files changed, 36 insertions, 27 deletions
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
index d8ffd548bf..fcaf6fdffe 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
@@ -6,6 +6,7 @@
#include "xfa/fgas/font/cfgas_defaultfontmanager.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/font/fgas_fontutils.h"
CFGAS_DefaultFontManager::CFGAS_DefaultFontManager() {}
@@ -19,35 +20,37 @@ RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont(
WideString wsFontName(wsFontFamily);
RetainPtr<CFGAS_GEFont> pFont =
pFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, 0xFFFF);
- if (!pFont) {
- const FGAS_FontInfo* pCurFont =
- FGAS_FontInfoByFontName(wsFontName.AsStringView());
- if (pCurFont && pCurFont->pReplaceFont) {
- uint32_t dwStyle = 0;
- // TODO(dsinclair): Why doesn't this check the other flags?
- if (FontStyleIsBold(dwFontStyles))
- dwStyle |= FXFONT_BOLD;
- if (FontStyleIsItalic(dwFontStyles))
- dwStyle |= FXFONT_ITALIC;
+ if (pFont)
+ return pFont;
+
+ const FGAS_FontInfo* pCurFont =
+ FGAS_FontInfoByFontName(wsFontName.AsStringView());
+ if (!pCurFont || !pCurFont->pReplaceFont)
+ return pFont;
- const wchar_t* pReplace = pCurFont->pReplaceFont;
- int32_t iLength = wcslen(pReplace);
- while (iLength > 0) {
- const wchar_t* pNameText = pReplace;
- while (*pNameText != L',' && iLength > 0) {
- pNameText++;
- iLength--;
- }
- WideString wsReplace = WideString(pReplace, pNameText - pReplace);
- pFont = pFontMgr->LoadFont(wsReplace.c_str(), dwStyle, 0xFFFF);
- if (pFont)
- break;
+ uint32_t dwStyle = 0;
+ // TODO(dsinclair): Why doesn't this check the other flags?
+ if (FontStyleIsBold(dwFontStyles))
+ dwStyle |= FXFONT_BOLD;
+ if (FontStyleIsItalic(dwFontStyles))
+ dwStyle |= FXFONT_ITALIC;
- iLength--;
- pNameText++;
- pReplace = pNameText;
- }
+ const wchar_t* pReplace = pCurFont->pReplaceFont;
+ int32_t iLength = wcslen(pReplace);
+ while (iLength > 0) {
+ const wchar_t* pNameText = pReplace;
+ while (*pNameText != L',' && iLength > 0) {
+ pNameText++;
+ iLength--;
}
+ WideString wsReplace = WideString(pReplace, pNameText - pReplace);
+ pFont = pFontMgr->LoadFont(wsReplace.c_str(), dwStyle, 0xFFFF);
+ if (pFont)
+ break;
+
+ iLength--;
+ pNameText++;
+ pReplace = pNameText;
}
return pFont;
}
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h
index 623beb4810..3d723d5e14 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.h
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.h
@@ -9,7 +9,9 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/retain_ptr.h"
-#include "xfa/fgas/font/cfgas_gefont.h"
+
+class CFGAS_GEFont;
+class CFGAS_FontMgr;
class CFGAS_DefaultFontManager {
public:
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 64ecf255a8..6f4a9814c9 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -20,8 +20,10 @@
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxge/dib/cfx_dibitmap.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fgas/font/cfgas_pdffontmgr.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 484e862510..d8150a6fa0 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -19,6 +19,7 @@
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 3ada2aa4d9..1f44b05a4a 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -33,6 +33,7 @@
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"