summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/cfgas_defaultfontmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/font/cfgas_defaultfontmanager.cpp')
-rw-r--r--xfa/fgas/font/cfgas_defaultfontmanager.cpp55
1 files changed, 29 insertions, 26 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;
}