Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: xfa/fgas/font/fgas_stdfontmgr.cpp

Issue 1872463002: Remove IFX_AdditionalFontMgr and IFX_FontMgrDelegate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« xfa/fgas/font/fgas_font.h ('K') | « xfa/fgas/font/fgas_stdfontmgr.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/font/fgas_stdfontmgr.cpp
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 2b403e8ee89ae547382a842ce21a9ba35bc8f1d9..eecaa8087aa38470590c5f8f6aee330b946b6c58 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -11,16 +11,11 @@
#include "xfa/fgas/font/fgas_fontutils.h"
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-IFX_FontMgr* IFX_FontMgr::Create(FX_LPEnumAllFonts pEnumerator,
- FX_LPMatchFont pMatcher,
- void* pUserData) {
- return new CFX_StdFontMgrImp(pEnumerator, pMatcher, pUserData);
-}
-CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator,
- FX_LPMatchFont pMatcher,
- void* pUserData)
- : m_pMatcher(pMatcher),
- m_pEnumerator(pEnumerator),
+IFX_FontMgr* IFX_FontMgr::Create(FX_LPEnumAllFonts pEnumerator) {
+ return new CFX_StdFontMgrImp(pEnumerator);
+}
+CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator)
+ : m_pEnumerator(pEnumerator),
m_FontFaces(),
m_Fonts(),
m_CPFonts(8),
@@ -29,16 +24,12 @@ CFX_StdFontMgrImp::CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator,
m_BufferFonts(4),
m_FileFonts(4),
m_StreamFonts(4),
- m_DeriveFonts(4),
- m_pUserData(pUserData) {
+ m_DeriveFonts(4) {
if (m_pEnumerator != NULL) {
- m_pEnumerator(m_FontFaces, m_pUserData, NULL, 0xFEFF);
- }
- if (m_pMatcher == NULL) {
- m_pMatcher = FX_DefFontMatcher;
+ m_pEnumerator(m_FontFaces, NULL, 0xFEFF);
}
- FXSYS_assert(m_pMatcher != NULL);
}
+
CFX_StdFontMgrImp::~CFX_StdFontMgrImp() {
m_FontFaces.RemoveAll();
m_CPFonts.RemoveAll();
@@ -302,9 +293,6 @@ FX_LPCFONTDESCRIPTOR CFX_StdFontMgrImp::FindFont(const FX_WCHAR* pszFontFamily,
uint16_t wCodePage,
uint32_t dwUSB,
FX_WCHAR wUnicode) {
- if (m_pMatcher == NULL) {
- return NULL;
- }
FX_FONTMATCHPARAMS params;
FXSYS_memset(&params, 0, sizeof(params));
params.dwUSB = dwUSB;
@@ -313,15 +301,15 @@ FX_LPCFONTDESCRIPTOR CFX_StdFontMgrImp::FindFont(const FX_WCHAR* pszFontFamily,
params.pwsFamily = pszFontFamily;
params.dwFontStyles = dwFontStyles;
params.dwMatchFlags = dwMatchFlags;
- FX_LPCFONTDESCRIPTOR pDesc = m_pMatcher(&params, m_FontFaces, m_pUserData);
+ FX_LPCFONTDESCRIPTOR pDesc = FX_DefFontMatcher(&params, m_FontFaces);
if (pDesc) {
return pDesc;
}
if (pszFontFamily && m_pEnumerator) {
CFX_FontDescriptors namedFonts;
- m_pEnumerator(namedFonts, m_pUserData, pszFontFamily, wUnicode);
+ m_pEnumerator(namedFonts, pszFontFamily, wUnicode);
params.pwsFamily = NULL;
- pDesc = m_pMatcher(&params, namedFonts, m_pUserData);
+ pDesc = FX_DefFontMatcher(&params, namedFonts);
if (pDesc == NULL) {
return NULL;
}
@@ -337,8 +325,7 @@ FX_LPCFONTDESCRIPTOR CFX_StdFontMgrImp::FindFont(const FX_WCHAR* pszFontFamily,
return NULL;
}
FX_LPCFONTDESCRIPTOR FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams,
- const CFX_FontDescriptors& fonts,
- void* pUserData) {
+ const CFX_FontDescriptors& fonts) {
FX_LPCFONTDESCRIPTOR pBestFont = NULL;
int32_t iBestSimilar = 0;
FX_BOOL bMatchStyle =
@@ -458,7 +445,6 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe,
return 1;
}
static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts,
- void* pUserData,
const FX_WCHAR* pwsFaceName,
FX_WCHAR wUnicode) {
HDC hDC = ::GetDC(NULL);
@@ -552,15 +538,14 @@ Restart:
}
return bsName;
}
-FX_POSITION CFX_FontSourceEnum_File::GetStartPosition(void* pUserData) {
+FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() {
m_wsNext = GetNextFile().UTF8Decode();
if (0 == m_wsNext.GetLength()) {
return (FX_POSITION)0;
}
return (FX_POSITION)-1;
}
-IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos,
- void* pUserData) {
+IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) {
IFX_FileAccess* pAccess =
FX_CreateDefaultFileAccess(m_wsNext.AsWideStringC());
m_wsNext = GetNextFile().UTF8Decode();
@@ -570,26 +555,19 @@ IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos,
IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum() {
return (IFX_FontSourceEnum*)new CFX_FontSourceEnum_File;
}
-IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum,
- IFX_FontMgrDelegate* pDelegate,
- void* pUserData) {
+IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum) {
if (NULL == pFontEnum) {
return NULL;
}
- CFX_FontMgrImp* pFontMgr =
- new CFX_FontMgrImp(pFontEnum, pDelegate, pUserData);
+ CFX_FontMgrImp* pFontMgr = new CFX_FontMgrImp(pFontEnum);
if (pFontMgr->EnumFonts()) {
return pFontMgr;
}
delete pFontMgr;
return NULL;
}
-CFX_FontMgrImp::CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum,
- IFX_FontMgrDelegate* pDelegate,
- void* pUserData)
- : m_pFontSource(pFontEnum),
- m_pDelegate(pDelegate),
- m_pUserData(pUserData) {}
+CFX_FontMgrImp::CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum)
+ : m_pFontSource(pFontEnum) {}
FX_BOOL CFX_FontMgrImp::EnumFontsFromFontMapper() {
CFX_FontMapper* pFontMapper =
@@ -692,30 +670,22 @@ void CFX_FontMgrImp::Release() {
IFX_Font* CFX_FontMgrImp::GetDefFontByCodePage(uint16_t wCodePage,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
- return NULL == m_pDelegate ? NULL : m_pDelegate->GetDefFontByCodePage(
- this, wCodePage, dwFontStyles,
- pszFontFamily);
+ return nullptr;
}
IFX_Font* CFX_FontMgrImp::GetDefFontByCharset(uint8_t nCharset,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
- return NULL == m_pDelegate ? NULL
- : m_pDelegate->GetDefFontByCharset(
- this, nCharset, dwFontStyles, pszFontFamily);
+ return nullptr;
}
IFX_Font* CFX_FontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
- return NULL == m_pDelegate ? NULL
- : m_pDelegate->GetDefFontByUnicode(
- this, wUnicode, dwFontStyles, pszFontFamily);
+ return nullptr;
}
IFX_Font* CFX_FontMgrImp::GetDefFontByLanguage(uint16_t wLanguage,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
- return NULL == m_pDelegate ? NULL : m_pDelegate->GetDefFontByLanguage(
- this, wLanguage, dwFontStyles,
- pszFontFamily);
+ return nullptr;
}
IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage,
uint32_t dwFontStyles,
« xfa/fgas/font/fgas_font.h ('K') | « xfa/fgas/font/fgas_stdfontmgr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698