From a7c03c678dbd6fd4732e0cfb390cc4f462434441 Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 7 Jun 2016 18:48:09 -0700 Subject: Remove dead code in CFGAS_FontMgrImp. And also CFGAS_StdFontMgrImp. Review-Url: https://codereview.chromium.org/2033673002 --- xfa/fgas/font/fgas_font.h | 13 --- xfa/fgas/font/fgas_gefont.cpp | 66 ++++----------- xfa/fgas/font/fgas_gefont.h | 18 ++-- xfa/fgas/font/fgas_stdfontmgr.cpp | 172 ++------------------------------------ xfa/fgas/font/fgas_stdfontmgr.h | 33 +------- xfa/fxfa/app/xfa_fontmgr.cpp | 2 +- 6 files changed, 33 insertions(+), 271 deletions(-) diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index 049c5a06ff..89641d7c72 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -105,7 +105,6 @@ class IFGAS_FontMgr { uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) = 0; virtual CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; - virtual CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFileName) = 0; virtual CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, const FX_WCHAR* pszFontAlias = NULL, uint32_t dwFontStyles = 0, @@ -162,18 +161,6 @@ class IFGAS_FontMgr { uint16_t wLanguage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, - int32_t iLength, - int32_t iFaceIndex, - int32_t* pFaceCount = NULL) = 0; - virtual CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFileName, - int32_t iFaceIndex, - int32_t* pFaceCount = NULL) = 0; - virtual CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, - int32_t iFaceIndex, - int32_t* pFaceCount = NULL, - FX_BOOL bSaveStream = FALSE) = 0; - virtual void ClearFontCache() = 0; virtual void RemoveFont(CFGAS_GEFont* pFont) = 0; }; diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index c26ad15c66..c07455556c 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -22,7 +22,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, return NULL; #else CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); - if (!pFont->LoadFont(pszFontFamily, dwFontStyles, wCodePage)) { + if (!pFont->LoadFontInternal(pszFontFamily, dwFontStyles, wCodePage)) { pFont->Release(); return NULL; } @@ -32,10 +32,9 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, // static CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExtFont, - IFGAS_FontMgr* pFontMgr, - FX_BOOL bTakeOver) { + IFGAS_FontMgr* pFontMgr) { CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); - if (!pFont->LoadFont(pExtFont, bTakeOver)) { + if (!pFont->LoadFontInternal(pExtFont)) { pFont->Release(); return NULL; } @@ -48,17 +47,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const uint8_t* pBuffer, int32_t iLength, IFGAS_FontMgr* pFontMgr) { CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); - if (!pFont->LoadFont(pBuffer, iLength)) { - pFont->Release(); - return nullptr; - } - return pFont; -} - -// static -CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFileName) { - CFGAS_GEFont* pFont = new CFGAS_GEFont(nullptr); - if (!pFont->LoadFontInternal(pszFileName)) { + if (!pFont->LoadFontInternal(pBuffer, iLength)) { pFont->Release(); return nullptr; } @@ -70,7 +59,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, IFGAS_FontMgr* pFontMgr, FX_BOOL bSaveStream) { CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); - if (!pFont->LoadFont(pFontStream, bSaveStream)) { + if (!pFont->LoadFontInternal(pFontStream, bSaveStream)) { pFont->Release(); return nullptr; } @@ -166,9 +155,9 @@ CFGAS_GEFont* CFGAS_GEFont::Retain() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { if (m_pFont) { return FALSE; } @@ -221,7 +210,7 @@ FX_BOOL CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, return bRet; } -FX_BOOL CFGAS_GEFont::LoadFont(const uint8_t* pBuffer, int32_t length) { +FX_BOOL CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) { if (m_pFont) { return FALSE; } @@ -234,29 +223,8 @@ FX_BOOL CFGAS_GEFont::LoadFont(const uint8_t* pBuffer, int32_t length) { return bRet; } -FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFileName) { - if (m_pFont || m_pStream || m_pFileRead) { - return FALSE; - } - m_pStream = IFX_Stream::CreateStream( - pszFileName, FX_STREAMACCESS_Binary | FX_STREAMACCESS_Read); - m_pFileRead = FX_CreateFileRead(m_pStream); - FX_BOOL bRet = FALSE; - if (m_pStream && m_pFileRead) { - m_pFont = new CFX_Font; - bRet = m_pFont->LoadFile(m_pFileRead); - if (bRet) { - bRet = InitFont(); - } else { - m_pFileRead->Release(); - m_pFileRead = nullptr; - } - } - m_wCharSet = 0xFFFF; - return bRet; -} - -FX_BOOL CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream) { +FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, + FX_BOOL bSaveStream) { if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1) { return FALSE; } @@ -277,20 +245,14 @@ FX_BOOL CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream) { } #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL CFGAS_GEFont::LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver) { +FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExtFont) { if (m_pFont || !pExtFont) { return FALSE; } m_pFont = pExtFont; - FX_BOOL bRet = !!m_pFont; - if (bRet) { - m_bExtFont = !bTakeOver; - bRet = InitFont(); - } else { - m_bExtFont = TRUE; - } + m_bExtFont = TRUE; m_wCharSet = 0xFFFF; - return bRet; + return InitFont(); } FX_BOOL CFGAS_GEFont::InitFont() { diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h index 877d292890..30f1c99159 100644 --- a/xfa/fgas/font/fgas_gefont.h +++ b/xfa/fgas/font/fgas_gefont.h @@ -22,14 +22,11 @@ class CFGAS_GEFont { uint32_t dwFontStyles, uint16_t wCodePage, IFGAS_FontMgr* pFontMgr); - static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, - IFGAS_FontMgr* pFontMgr, - FX_BOOL bTakeOver); + static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, IFGAS_FontMgr* pFontMgr); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength, IFGAS_FontMgr* pFontMgr); - static CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFileName); static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, IFGAS_FontMgr* pFontMgr, FX_BOOL bSaveStream); @@ -70,14 +67,13 @@ class CFGAS_GEFont { CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - FX_BOOL LoadFont(const uint8_t* pBuffer, int32_t length); - FX_BOOL LoadFontInternal(const FX_WCHAR* pszFileName); - FX_BOOL LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream); + FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); + FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); #endif - FX_BOOL LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver); + FX_BOOL LoadFontInternal(CFX_Font* pExtFont); FX_BOOL InitFont(); FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, CFX_Rect& bbox, diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 17bd204889..4e5095048b 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -23,7 +23,6 @@ CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) m_FamilyFonts(16), m_UnicodeFonts(16), m_BufferFonts(4), - m_FileFonts(4), m_StreamFonts(4), m_DeriveFonts(4) { if (m_pEnumerator) { @@ -37,7 +36,6 @@ CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() { m_FamilyFonts.RemoveAll(); m_UnicodeFonts.RemoveAll(); m_BufferFonts.RemoveAll(); - m_FileFonts.RemoveAll(); m_StreamFonts.RemoveAll(); m_DeriveFonts.RemoveAll(); for (int32_t i = m_Fonts.GetUpperBound(); i >= 0; i--) @@ -174,23 +172,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, } return NULL; } -CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) { - ASSERT(pszFileName); - uint32_t dwHash = FX_HashCode_GetW(pszFileName, false); - CFGAS_GEFont* pFont = NULL; - if (m_FileFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { - if (pFont) { - return pFont->Retain(); - } - } - pFont = CFGAS_GEFont::LoadFont(pszFileName); - if (pFont) { - m_Fonts.Add(pFont); - m_FileFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); - return pFont->Retain(); - } - return NULL; -} + CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, const FX_WCHAR* pszFontAlias, uint32_t dwFontStyles, @@ -277,7 +259,6 @@ void CFGAS_StdFontMgrImp::RemoveFont(CFGAS_GEFont* pFont) { RemoveFont(m_FamilyFonts, pFont); RemoveFont(m_UnicodeFonts, pFont); RemoveFont(m_BufferFonts, pFont); - RemoveFont(m_FileFonts, pFont); RemoveFont(m_StreamFonts, pFont); RemoveFont(m_DeriveFonts, pFont); int32_t iFind = m_Fonts.Find(pFont); @@ -639,24 +620,6 @@ void CFGAS_FontMgrImp::Release() { delete pFonts; } m_Hash2Fonts.RemoveAll(); - pos = m_Hash2FileAccess.GetStartPosition(); - while (pos) { - uint32_t dwHash; - IFX_FileAccess* pFileAccess; - m_Hash2FileAccess.GetNextAssoc(pos, dwHash, pFileAccess); - if (NULL != pFileAccess) { - pFileAccess->Release(); - } - } - pos = m_FileAccess2IFXFont.GetStartPosition(); - while (pos) { - uint32_t dwHash; - CFGAS_GEFont* pFont; - m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pFont); - if (NULL != pFont) { - pFont->Release(); - } - } pos = m_IFXFont2FileRead.GetStartPosition(); while (pos) { CFGAS_GEFont* pFont; @@ -724,9 +687,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByCodePage( CFX_FontDescriptor* pDesc = sortedFonts->GetAt(0).pFont; CFGAS_GEFont* pFont = - pDesc->m_pFileAccess - ? LoadFont(pDesc->m_pFileAccess, pDesc->m_nFaceIndex, nullptr) - : LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); + LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); if (pFont) pFont->SetLogicalFontStyle(dwFontStyles); @@ -780,10 +741,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( CFX_FontDescriptor* pDesc = sortedFonts->GetAt(i).pFont; if (!VerifyUnicode(pDesc, wUnicode)) continue; - if (pDesc->m_pFileAccess) - pFont = LoadFont(pDesc->m_pFileAccess, pDesc->m_nFaceIndex, nullptr); - else - pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); + pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); if (!pFont) continue; pFont->SetLogicalFontStyle(dwFontStyles); @@ -796,11 +754,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( } FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode) { - IFX_FileRead* pFileRead = nullptr; - if (pDesc->m_pFileAccess) - pFileRead = pDesc->m_pFileAccess->CreateFileStream(FX_FILEMODE_ReadOnly); - else - pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); + IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) return FALSE; FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex); @@ -840,97 +794,6 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByLanguage( pszFontFamily); } -CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const uint8_t* pBuffer, - int32_t iLength, - int32_t iFaceIndex, - int32_t* pFaceCount) { - void* Hash[2] = {(void*)(uintptr_t)pBuffer, (void*)(uintptr_t)iLength}; - uint32_t dwHash = - FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)Hash, sizeof(Hash)), false); - IFX_FileAccess* pFontAccess = nullptr; - m_Hash2FileAccess.Lookup(dwHash, pFontAccess); - return pFontAccess ? LoadFont(pFontAccess, iFaceIndex, pFaceCount, TRUE) - : nullptr; -} - -CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName, - int32_t iFaceIndex, - int32_t* pFaceCount) { - CFX_ByteString bsHash; - bsHash += CFX_WideString(pszFileName).UTF8Encode(); - - uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); - IFX_FileAccess* pFontAccess = nullptr; - if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) { - pFontAccess = FX_CreateDefaultFileAccess(pszFileName); - m_Hash2FileAccess.SetAt(dwHash, pFontAccess); - } - - return pFontAccess ? LoadFont(pFontAccess, iFaceIndex, pFaceCount, TRUE) - : nullptr; -} - -CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(IFX_Stream* pFontStream, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bSaveStream) { - void* Hash[1] = {(void*)(uintptr_t)pFontStream}; - uint32_t dwHash = - FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)Hash, sizeof(Hash)), false); - IFX_FileAccess* pFontAccess = nullptr; - m_Hash2FileAccess.Lookup(dwHash, pFontAccess); - - return pFontAccess ? LoadFont(pFontAccess, iFaceIndex, pFaceCount, TRUE) - : nullptr; -} - -CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bWantCache) { - uint32_t dwHash = 0; - CFGAS_GEFont* pFont = nullptr; - if (bWantCache) { - CFX_ByteString bsHash; - bsHash.Format("%d, %d", (uintptr_t)pFontAccess, iFaceIndex); - dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); - if (m_FileAccess2IFXFont.Lookup(dwHash, pFont)) { - if (pFont) { - if (pFaceCount) - *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; - return pFont->Retain(); - } - } - } - - CFX_Font* pInternalFont = new CFX_Font; - IFX_FileRead* pFontStream = - pFontAccess->CreateFileStream(FX_FILEMODE_ReadOnly); - if (!pFontStream) { - delete pInternalFont; - return nullptr; - } - if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { - delete pInternalFont; - pFontStream->Release(); - return nullptr; - } - pFont = CFGAS_GEFont::LoadFont(pInternalFont, this, TRUE); - if (!pFont) { - delete pInternalFont; - pFontStream->Release(); - return nullptr; - } - if (bWantCache) - m_FileAccess2IFXFont.SetAt(dwHash, pFont); - - m_IFXFont2FileRead.SetAt(pFont, pFontStream); - if (pFaceCount) - *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; - - return pFont; -} - CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount) { @@ -958,7 +821,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName, return nullptr; } - CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this, FALSE); + CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this); if (!pFont) { pFontStream->Release(); return nullptr; @@ -1219,15 +1082,6 @@ void CFGAS_FontMgrImp::ClearFontCache() { m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs); delete pDescs; } - pos = m_FileAccess2IFXFont.GetStartPosition(); - while (pos) { - uint32_t dwHash; - CFGAS_GEFont* pFont; - m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pFont); - if (NULL != pFont) { - pFont->Release(); - } - } pos = m_IFXFont2FileRead.GetStartPosition(); while (pos) { CFGAS_GEFont* pFont; @@ -1246,16 +1100,6 @@ void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { m_IFXFont2FileRead.RemoveKey(pEFont); } FX_POSITION pos; - pos = m_FileAccess2IFXFont.GetStartPosition(); - while (pos) { - uint32_t dwHash; - CFGAS_GEFont* pCFont; - m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pCFont); - if (pCFont == pEFont) { - m_FileAccess2IFXFont.RemoveKey(dwHash); - break; - } - } pos = m_Hash2Fonts.GetStartPosition(); while (pos) { uint32_t dwHash; @@ -1275,8 +1119,7 @@ void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace, CFX_FontDescriptors& Fonts, - const CFX_WideString* pFaceName, - IFX_FileAccess* pFontAccess) { + const CFX_WideString* pFaceName) { if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) return; @@ -1312,7 +1155,6 @@ void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace, pFaceName ? *pFaceName : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); pFont->m_nFaceIndex = pFace->face_index; - pFont->m_pFileAccess = pFontAccess ? pFontAccess->Retain() : nullptr; Fonts.Add(pFont); } @@ -1328,7 +1170,7 @@ void CFGAS_FontMgrImp::RegisterFaces(IFX_FileRead* pFontStream, // All faces keep number of faces. It can be retrieved from any one face. if (num_faces == 0) num_faces = pFace->num_faces; - RegisterFace(pFace, m_InstalledFonts, pFaceName, nullptr); + RegisterFace(pFace, m_InstalledFonts, pFaceName); if (FXFT_Get_Face_External_Stream(pFace)) FXFT_Clear_Face_External_Stream(pFace); FXFT_Done_Face(pFace); diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index cbc10584ec..b20c942a36 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -45,7 +45,6 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) override; CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength) override; - CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFileName) override; CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, const FX_WCHAR* pszFontAlias = NULL, uint32_t dwFontStyles = 0, @@ -75,7 +74,6 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { CFX_MapPtrToPtr m_FamilyFonts; CFX_MapPtrToPtr m_UnicodeFonts; CFX_MapPtrToPtr m_BufferFonts; - CFX_MapPtrToPtr m_FileFonts; CFX_MapPtrToPtr m_StreamFonts; CFX_MapPtrToPtr m_DeriveFonts; }; @@ -85,17 +83,12 @@ uint32_t FX_GetGdiFontStyles(const LOGFONTW& lf); class CFX_FontDescriptor { public: - CFX_FontDescriptor() - : m_pFileAccess(NULL), m_nFaceIndex(0), m_dwFontStyles(0) { + CFX_FontDescriptor() : m_nFaceIndex(0), m_dwFontStyles(0) { m_dwUsb[0] = m_dwUsb[1] = m_dwUsb[2] = m_dwUsb[3] = 0; m_dwCsb[0] = m_dwCsb[1] = 0; } - ~CFX_FontDescriptor() { - if (NULL != m_pFileAccess) { - m_pFileAccess->Release(); - } - } - IFX_FileAccess* m_pFileAccess; + ~CFX_FontDescriptor() {} + int32_t m_nFaceIndex; CFX_WideString m_wsFaceName; CFX_WideStringArray m_wsFamilyNames; @@ -185,17 +178,6 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { uint16_t wLanguage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) override; - CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, - int32_t iLength, - int32_t iFaceIndex, - int32_t* pFaceCount) override; - CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFileName, - int32_t iFaceIndex, - int32_t* pFaceCount) override; - CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bSaveStream = FALSE) override; void ClearFontCache() override; void RemoveFont(CFGAS_GEFont* pFont) override; @@ -209,8 +191,7 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { protected: void RegisterFace(FXFT_Face pFace, CFX_FontDescriptors& Fonts, - const CFX_WideString* pFaceName, - IFX_FileAccess* pFontAccess); + const CFX_WideString* pFaceName); void RegisterFaces(IFX_FileRead* pFontStream, const CFX_WideString* pFaceName); void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names); @@ -231,10 +212,6 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { uint32_t dwFontStyles, const CFX_WideString& FontName, FX_WCHAR wcUnicode = 0xFFFE); - CFGAS_GEFont* LoadFont(IFX_FileAccess* pFontAccess, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bWantCache = FALSE); FXFT_Face LoadFace(IFX_FileRead* pFontStream, int32_t iFaceIndex); IFX_FileRead* CreateFontStream(CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, @@ -243,8 +220,6 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { CFX_MapPtrTemplate m_Hash2CandidateList; CFX_MapPtrTemplate*> m_Hash2Fonts; - CFX_MapPtrTemplate m_Hash2FileAccess; - CFX_MapPtrTemplate m_FileAccess2IFXFont; CFX_MapPtrTemplate m_IFXFont2FileRead; CFX_MapPtrTemplate m_FailedUnicodes2NULL; CFX_FontSourceEnum_File* const m_pFontSource; diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 964c0352b8..17d600dfa0 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1869,7 +1869,7 @@ CFGAS_GEFont* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, *pDstPDFFont = pPDFFont; return NULL; } - return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr, FALSE); + return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr); } return NULL; } -- cgit v1.2.3