summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-02-29 13:04:09 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-02-29 13:04:09 -0500
commit42bf7a3571c0071e9efbaa0735b406ec55aae59a (patch)
tree30214bb0d8c76c3e69155cac9270529a9a16e228
parentba9d15c048c3daf5926bef6737954b472dbbb88f (diff)
downloadpdfium-42bf7a3571c0071e9efbaa0735b406ec55aae59a.tar.xz
Remove _FX_USEGASFONTMGR_ as it is always defined
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1749793002 .
-rw-r--r--xfa/src/fgas/src/font/fx_stdfontmgr.cpp58
1 files changed, 17 insertions, 41 deletions
diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
index e187a2e07d..a8fab8817c 100644
--- a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
+++ b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
@@ -90,60 +90,35 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCharset(
return GetDefFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles,
pszFontFamily);
}
-#define _FX_USEGASFONTMGR_
+
IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(
FX_WCHAR wUnicode,
FX_DWORD dwFontStyles,
const FX_WCHAR* pszFontFamily) {
const FGAS_FONTUSB* pRet = FGAS_GetUnicodeBitField(wUnicode);
- if (pRet->wBitField == 999) {
- return NULL;
- }
+ if (pRet->wBitField == 999)
+ return nullptr;
+
FX_DWORD dwHash =
FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, pRet->wBitField);
- IFX_Font* pFont = NULL;
- if (m_UnicodeFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
- return pFont ? LoadFont(pFont, dwFontStyles, pRet->wCodePage) : NULL;
- }
-#ifdef _FX_USEGASFONTMGR_
+ IFX_Font* pFont = nullptr;
+ if (m_UnicodeFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont))
+ return pFont ? LoadFont(pFont, dwFontStyles, pRet->wCodePage) : nullptr;
+
FX_LPCFONTDESCRIPTOR pFD =
FindFont(pszFontFamily, dwFontStyles, FALSE, pRet->wCodePage,
pRet->wBitField, wUnicode);
- if (pFD == NULL && pszFontFamily) {
- pFD = FindFont(NULL, dwFontStyles, FALSE, pRet->wCodePage, pRet->wBitField,
- wUnicode);
+ if (!pFD && pszFontFamily) {
+ pFD = FindFont(nullptr, dwFontStyles, FALSE, pRet->wCodePage,
+ pRet->wBitField, wUnicode);
}
- if (pFD == NULL) {
- return NULL;
- }
- FXSYS_assert(pFD);
+ if (!pFD)
+ return nullptr;
+
FX_WORD wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet);
const FX_WCHAR* pFontFace = pFD->wsFontFace;
pFont = IFX_Font::LoadFont(pFontFace, dwFontStyles, wCodePage, this);
-#else
- CFX_FontMapper* pBuiltinMapper =
- CFX_GEModule::Get()->GetFontMgr()->m_pBuiltinMapper;
- if (pBuiltinMapper == NULL) {
- return NULL;
- }
- int32_t iWeight =
- (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
- int italic_angle = 0;
- FXFT_Face ftFace = pBuiltinMapper->FindSubstFontByUnicode(
- wUnicode, dwFontStyles, iWeight, italic_angle);
- if (ftFace == NULL) {
- return NULL;
- }
- CFX_Font* pFXFont = new CFX_Font;
- pFXFont->m_Face = ftFace;
- pFXFont->m_pFontData = FXFT_Get_Face_Stream_Base(ftFace);
- pFXFont->m_dwSize = FXFT_Get_Face_Stream_Size(ftFace);
- pFont = IFX_Font::LoadFont(pFXFont, this);
- FX_WORD wCodePage = pRet->wCodePage;
- CFX_WideString wsPsName = pFXFont->GetPsName();
- const FX_WCHAR* pFontFace = wsPsName;
-#endif
- if (pFont != NULL) {
+ if (pFont) {
m_Fonts.Add(pFont);
m_UnicodeFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
@@ -152,8 +127,9 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode(
m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
return LoadFont(pFont, dwFontStyles, wCodePage);
}
- return NULL;
+ return nullptr;
}
+
IFX_Font* CFX_StdFontMgrImp::GetDefFontByLanguage(
FX_WORD wLanguage,
FX_DWORD dwFontStyles,