diff options
Diffstat (limited to 'xfa/fgas')
-rw-r--r-- | xfa/fgas/font/cfgas_defaultfontmanager.cpp | 8 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_defaultfontmanager.h | 20 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.cpp | 82 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.h | 90 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.cpp | 36 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.h | 46 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_pdffontmgr.cpp | 19 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_pdffontmgr.h | 28 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_break.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_break.h | 6 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakpiece.h | 4 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak.cpp | 5 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak.h | 8 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak_unittest.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_txtbreak.cpp | 4 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_txtbreak.h | 2 |
16 files changed, 176 insertions, 186 deletions
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp index 480525802b..d3864be16a 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp +++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp @@ -12,13 +12,13 @@ CFGAS_DefaultFontManager::CFGAS_DefaultFontManager() {} CFGAS_DefaultFontManager::~CFGAS_DefaultFontManager() {} -CFX_RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont( +RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { WideString wsFontName(wsFontFamily); - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = pFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const FGAS_FontInfo* pCurFont = @@ -54,12 +54,12 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont( return pFont; } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetDefaultFont( +RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetDefaultFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = pFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) { pFont = pFontMgr->LoadFont(static_cast<const wchar_t*>(nullptr), diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h index b596efc719..4e2e5e10d4 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.h +++ b/xfa/fgas/font/cfgas_defaultfontmanager.h @@ -9,8 +9,8 @@ #include <vector> -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_gefont.h" class CFGAS_DefaultFontManager { @@ -18,17 +18,17 @@ class CFGAS_DefaultFontManager { CFGAS_DefaultFontManager(); ~CFGAS_DefaultFontManager(); - CFX_RetainPtr<CFGAS_GEFont> GetFont(CFGAS_FontMgr* pFontMgr, - const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); - CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont(CFGAS_FontMgr* pFontMgr, - const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + RetainPtr<CFGAS_GEFont> GetFont(CFGAS_FontMgr* pFontMgr, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + RetainPtr<CFGAS_GEFont> GetDefaultFont(CFGAS_FontMgr* pFontMgr, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); private: - std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_CacheFonts; + std::vector<RetainPtr<CFGAS_GEFont>> m_CacheFonts; }; #endif // XFA_FGAS_FONT_CFGAS_DEFAULTFONTMANAGER_H_ diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index f2405e9844..da1763214b 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -197,7 +197,7 @@ CFGAS_FontMgr::CFGAS_FontMgr(FX_LPEnumAllFonts pEnumerator) CFGAS_FontMgr::~CFGAS_FontMgr() {} -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -215,7 +215,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( if (!pFD) return nullptr; - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); if (!pFont) return nullptr; @@ -227,7 +227,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( return LoadFont(pFont, dwFontStyles, wCodePage); } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( wchar_t wUnicode, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -254,7 +254,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( uint16_t wCodePage = GetCodePageFromCharset(pFD->uCharSet); const wchar_t* pFontFace = pFD->wsFontFace; - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = CFGAS_GEFont::LoadFont(pFontFace, dwFontStyles, wCodePage, this); if (!pFont) return nullptr; @@ -266,11 +266,10 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( return LoadFont(pFont, dwFontStyles, wCodePage); } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { - CFX_RetainPtr<CFGAS_GEFont> pFont; +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { + RetainPtr<CFGAS_GEFont> pFont; uint32_t dwHash = GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); auto it = m_FamilyFonts.find(dwHash); if (it != m_FamilyFonts.end()) @@ -298,8 +297,8 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( return LoadFont(pFont, dwFontStyles, wCodePage); } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const CFX_RetainPtr<CFGAS_GEFont>& pSrcFont, +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( + const RetainPtr<CFGAS_GEFont>& pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage) { if (pSrcFont->GetFontStyles() == dwFontStyles) @@ -313,7 +312,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( if (it != m_DeriveFonts.end() && it->second) return it->second; - CFX_RetainPtr<CFGAS_GEFont> pFont = pSrcFont->Derive(dwFontStyles, wCodePage); + RetainPtr<CFGAS_GEFont> pFont = pSrcFont->Derive(dwFontStyles, wCodePage); if (!pFont) return nullptr; @@ -325,8 +324,8 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( } void CFGAS_FontMgr::RemoveFont( - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>>* pFontMap, - const CFX_RetainPtr<CFGAS_GEFont>& pFont) { + std::map<uint32_t, RetainPtr<CFGAS_GEFont>>* pFontMap, + const RetainPtr<CFGAS_GEFont>& pFont) { auto iter = pFontMap->begin(); while (iter != pFontMap->end()) { auto old_iter = iter++; @@ -335,7 +334,7 @@ void CFGAS_FontMgr::RemoveFont( } } -void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) { +void CFGAS_FontMgr::RemoveFont(const RetainPtr<CFGAS_GEFont>& pFont) { RemoveFont(&m_CPFonts, pFont); RemoveFont(&m_FamilyFonts, pFont); RemoveFont(&m_UnicodeFonts, pFont); @@ -680,7 +679,7 @@ bool CFX_FontSourceEnum_File::HasStartPosition() { return m_wsNext.GetLength() != 0; } -CFX_RetainPtr<CFX_CRTFileAccess> CFX_FontSourceEnum_File::GetNext() { +RetainPtr<CFX_CRTFileAccess> CFX_FontSourceEnum_File::GetNext() { if (m_wsNext.GetLength() == 0) return nullptr; @@ -717,7 +716,7 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { pSystemFontInfo->EnumFontList(pFontMapper); for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { - CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = + RetainPtr<IFX_SeekableReadStream> pFontStream = CreateFontStream(pFontMapper, pSystemFontInfo, i); if (!pFontStream) continue; @@ -734,9 +733,8 @@ bool CFGAS_FontMgr::EnumFontsFromFiles() { if (!m_pFontSource->HasStartPosition()) return !m_InstalledFonts.empty(); - while (CFX_RetainPtr<CFX_CRTFileAccess> pFontSource = - m_pFontSource->GetNext()) { - CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = + while (RetainPtr<CFX_CRTFileAccess> pFontSource = m_pFontSource->GetNext()) { + RetainPtr<IFX_SeekableReadStream> pFontStream = pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); if (pFontStream) RegisterFaces(pFontStream, nullptr); @@ -748,14 +746,13 @@ bool CFGAS_FontMgr::EnumFonts() { return EnumFontsFromFontMapper() || EnumFontsFromFiles(); } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -763,7 +760,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); - std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash]; + std::vector<RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash]; if (!pFontArray->empty()) return (*pFontArray)[0]; @@ -780,7 +777,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( return nullptr; CFX_FontDescriptor* pDesc = (*sortedFontInfos)[0].pFont; - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); if (!pFont) return nullptr; @@ -790,7 +787,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( return pFont; } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( wchar_t wUnicode, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { @@ -807,7 +804,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); - std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash]; + std::vector<RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash]; for (size_t i = 0; i < pFonts->size(); ++i) { if (VerifyUnicode((*pFonts)[i], wUnicode)) return (*pFonts)[i]; @@ -825,7 +822,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( CFX_FontDescriptor* pDesc = info.pFont; if (!VerifyUnicode(pDesc, wUnicode)) continue; - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); if (!pFont) continue; @@ -840,7 +837,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode) { - CFX_RetainPtr<IFX_SeekableReadStream> pFileRead = + RetainPtr<IFX_SeekableReadStream> pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) return false; @@ -858,7 +855,7 @@ bool CFGAS_FontMgr::VerifyUnicode(CFX_FontDescriptor* pDesc, return !retCharmap && retIndex; } -bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, +bool CFGAS_FontMgr::VerifyUnicode(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode) { if (!pFont) return false; @@ -875,10 +872,9 @@ bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, return true; } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const WideString& wsFaceName, - int32_t iFaceIndex, - int32_t* pFaceCount) { +RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(const WideString& wsFaceName, + int32_t iFaceIndex, + int32_t* pFaceCount) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); if (!pFontMapper) @@ -888,7 +884,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( if (!pSystemFontInfo) return nullptr; - CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = + RetainPtr<IFX_SeekableReadStream> pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); if (!pFontStream) return nullptr; @@ -897,7 +893,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) return nullptr; - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = CFGAS_GEFont::LoadFont(std::move(pInternalFont), this); if (!pFont) return nullptr; @@ -930,7 +926,7 @@ void _ftStreamClose(FXFT_Stream stream) {} }; // extern "C" FXFT_Face CFGAS_FontMgr::LoadFace( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, + const RetainPtr<IFX_SeekableReadStream>& pFontStream, int32_t iFaceIndex) { if (!pFontStream) return nullptr; @@ -971,7 +967,7 @@ FXFT_Face CFGAS_FontMgr::LoadFace( return pFace; } -CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( +RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, uint32_t index) { @@ -992,7 +988,7 @@ CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( return pdfium::MakeRetain<CFX_MemoryStream>(pBuffer, dwFileSize, true); } -CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( +RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( const ByteString& bsFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); @@ -1101,7 +1097,7 @@ int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, return nPenalty; } -void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pEFont) { +void CFGAS_FontMgr::RemoveFont(const RetainPtr<CFGAS_GEFont>& pEFont) { if (!pEFont) return; @@ -1155,7 +1151,7 @@ void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const WideString* pFaceName) { } void CFGAS_FontMgr::RegisterFaces( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, + const RetainPtr<IFX_SeekableReadStream>& pFontStream, const WideString* pFaceName) { int32_t index = 0; int32_t num_faces = 0; diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 642ba6fb67..0bcee12e4d 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -14,10 +14,10 @@ #include <vector> #include "core/fxcrt/cfx_crtfileaccess.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/observable.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ifx_systemfontinfo.h" @@ -88,24 +88,23 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { explicit CFGAS_FontMgr(FX_LPEnumAllFonts pEnumerator); ~CFGAS_FontMgr(); - CFX_RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); + RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + void RemoveFont(const RetainPtr<CFGAS_GEFont>& pFont); private: - CFX_RetainPtr<CFGAS_GEFont> LoadFont( - const CFX_RetainPtr<CFGAS_GEFont>& pSrcFont, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>>* pFontMap, - const CFX_RetainPtr<CFGAS_GEFont>& pFont); + RetainPtr<CFGAS_GEFont> LoadFont(const RetainPtr<CFGAS_GEFont>& pSrcFont, + uint32_t dwFontStyles, + uint16_t wCodePage); + void RemoveFont(std::map<uint32_t, RetainPtr<CFGAS_GEFont>>* pFontMap, + const RetainPtr<CFGAS_GEFont>& pFont); const FX_FONTDESCRIPTOR* FindFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint32_t dwMatchFlags, @@ -115,13 +114,13 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { FX_LPEnumAllFonts m_pEnumerator; std::deque<FX_FONTDESCRIPTOR> m_FontFaces; - std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_Fonts; - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>> m_CPFonts; - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>> m_FamilyFonts; - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>> m_UnicodeFonts; - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>> m_BufferFonts; - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>> m_StreamFonts; - std::map<uint32_t, CFX_RetainPtr<CFGAS_GEFont>> m_DeriveFonts; + std::vector<RetainPtr<CFGAS_GEFont>> m_Fonts; + std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_CPFonts; + std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_FamilyFonts; + std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_UnicodeFonts; + std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_BufferFonts; + std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_StreamFonts; + std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_DeriveFonts; }; #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -170,7 +169,7 @@ class CFX_FontSourceEnum_File { ~CFX_FontSourceEnum_File(); bool HasStartPosition(); - CFX_RetainPtr<CFX_CRTFileAccess> GetNext(); + RetainPtr<CFX_CRTFileAccess> GetNext(); private: ByteString GetNextFile(); @@ -188,31 +187,30 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { explicit CFGAS_FontMgr(CFX_FontSourceEnum_File* pFontEnum); ~CFGAS_FontMgr(); - CFX_RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode, - uint32_t dwFontStyles, - const wchar_t* pszFontFamily); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); + RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr<CFGAS_GEFont> GetFontByUnicode(wchar_t wUnicode, + uint32_t dwFontStyles, + const wchar_t* pszFontFamily); + RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + void RemoveFont(const RetainPtr<CFGAS_GEFont>& pFont); private: bool EnumFonts(); bool EnumFontsFromFontMapper(); bool EnumFontsFromFiles(); void RegisterFace(FXFT_Face pFace, const WideString* pFaceName); - void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, + void RegisterFaces(const RetainPtr<IFX_SeekableReadStream>& pFontStream, const WideString* pFaceName); void GetNames(const uint8_t* name_table, std::vector<WideString>& Names); std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode); - bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, - wchar_t wcUnicode); + bool VerifyUnicode(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode); int32_t IsPartName(const WideString& Name1, const WideString& Name2); void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts, uint16_t wCodePage, @@ -224,24 +222,24 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { uint32_t dwFontStyles, const WideString& FontName, wchar_t wcUnicode = 0xFFFE); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const WideString& wsFaceName, - int32_t iFaceIndex, - int32_t* pFaceCount); - FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, + RetainPtr<CFGAS_GEFont> LoadFont(const WideString& wsFaceName, + int32_t iFaceIndex, + int32_t* pFaceCount); + FXFT_Face LoadFace(const RetainPtr<IFX_SeekableReadStream>& pFontStream, int32_t iFaceIndex); - CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( + RetainPtr<IFX_SeekableReadStream> CreateFontStream( CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, uint32_t index); - CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( + RetainPtr<IFX_SeekableReadStream> CreateFontStream( const ByteString& bsFaceName); CFX_FontSourceEnum_File* const m_pFontSource; std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts; std::map<uint32_t, std::unique_ptr<std::vector<CFX_FontDescriptorInfo>>> m_Hash2CandidateList; - std::map<uint32_t, std::vector<CFX_RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; - std::map<CFX_RetainPtr<CFGAS_GEFont>, CFX_RetainPtr<IFX_SeekableReadStream>> + std::map<uint32_t, std::vector<RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; + std::map<RetainPtr<CFGAS_GEFont>, RetainPtr<IFX_SeekableReadStream>> m_IFXFont2FileRead; std::set<wchar_t> m_FailedUnicodesSet; }; diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index 404b23cf7b..ba79d77ca0 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -17,10 +17,10 @@ #include "xfa/fgas/font/fgas_fontutils.h" // static -CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - CFGAS_FontMgr* pFontMgr) { +RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + CFGAS_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (!pFontMgr) return nullptr; @@ -35,8 +35,8 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(const wchar_t* pszFontFamily, } // static -CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont, - CFGAS_FontMgr* pFontMgr) { +RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont, + CFGAS_FontMgr* pFontMgr) { auto pFont = pdfium::MakeRetain<CFGAS_GEFont>(pFontMgr); if (!pFont->LoadFontInternal(pExternalFont)) return nullptr; @@ -44,7 +44,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont, } // static -CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont( +RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont( std::unique_ptr<CFX_Font> pInternalFont, CFGAS_FontMgr* pFontMgr) { auto pFont = pdfium::MakeRetain<CFGAS_GEFont>(pFontMgr); @@ -64,7 +64,7 @@ CFGAS_GEFont::CFGAS_GEFont(CFGAS_FontMgr* pFontMgr) m_pFontMgr(pFontMgr) { } -CFGAS_GEFont::CFGAS_GEFont(const CFX_RetainPtr<CFGAS_GEFont>& src, +CFGAS_GEFont::CFGAS_GEFont(const RetainPtr<CFGAS_GEFont>& src, uint32_t dwFontStyles) : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ @@ -164,9 +164,9 @@ bool CFGAS_GEFont::InitFont() { return !!m_pFontEncoding; } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::Derive(uint32_t dwFontStyles, - uint16_t wCodePage) { - CFX_RetainPtr<CFGAS_GEFont> pFont(this); +RetainPtr<CFGAS_GEFont> CFGAS_GEFont::Derive(uint32_t dwFontStyles, + uint16_t wCodePage) { + RetainPtr<CFGAS_GEFont> pFont(this); if (GetFontStyles() == dwFontStyles) return pFont; return pdfium::MakeRetain<CFGAS_GEFont>(pFont, dwFontStyles); @@ -223,9 +223,9 @@ bool CFGAS_GEFont::GetCharWidthInternal(wchar_t wUnicode, return true; if (!m_pProvider || - !m_pProvider->GetCharWidth(CFX_RetainPtr<CFGAS_GEFont>(this), wUnicode, + !m_pProvider->GetCharWidth(RetainPtr<CFGAS_GEFont>(this), wUnicode, bCharCode, &iWidth)) { - CFX_RetainPtr<CFGAS_GEFont> pFont; + RetainPtr<CFGAS_GEFont> pFont; int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont) { if (pFont.Get() == this) { @@ -260,7 +260,7 @@ bool CFGAS_GEFont::GetCharBBoxInternal(wchar_t wUnicode, return true; } - CFX_RetainPtr<CFGAS_GEFont> pFont; + RetainPtr<CFGAS_GEFont> pFont; int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (!pFont || iGlyph == 0xFFFF) return false; @@ -296,7 +296,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bCharCode) { int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, bool bRecursive, - CFX_RetainPtr<CFGAS_GEFont>* ppFont, + RetainPtr<CFGAS_GEFont>* ppFont, bool bCharCode) { int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { @@ -330,7 +330,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, return 0xFFFF; WideString wsFamily = GetFamilyName(); - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), wsFamily.c_str()); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (!pFont) @@ -358,9 +358,9 @@ int32_t CFGAS_GEFont::GetDescent() const { return m_pFont->GetDescent(); } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) { +RetainPtr<CFGAS_GEFont> CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) { iGlyphIndex = static_cast<uint32_t>(iGlyphIndex) >> 24; if (iGlyphIndex == 0) - return CFX_RetainPtr<CFGAS_GEFont>(this); + return RetainPtr<CFGAS_GEFont>(this); return m_SubstFonts[iGlyphIndex - 1]; } diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index c83fc4319d..f88f8b4cd9 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -11,9 +11,9 @@ #include <memory> #include <vector> -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fgas/font/cfgas_pdffontmgr.h" @@ -22,25 +22,24 @@ class CFGAS_FontMgr; class CFX_UnicodeEncoding; -class CFGAS_GEFont : public CFX_Retainable { +class CFGAS_GEFont : public Retainable { public: template <typename T> - friend class CFX_RetainPtr; + friend class RetainPtr; template <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); - static CFX_RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - CFGAS_FontMgr* pFontMgr); - static CFX_RetainPtr<CFGAS_GEFont> LoadFont(CFX_Font* pExternalFont, - CFGAS_FontMgr* pFontMgr); - static CFX_RetainPtr<CFGAS_GEFont> LoadFont( + static RetainPtr<CFGAS_GEFont> LoadFont(const wchar_t* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + CFGAS_FontMgr* pFontMgr); + static RetainPtr<CFGAS_GEFont> LoadFont(CFX_Font* pExternalFont, + CFGAS_FontMgr* pFontMgr); + static RetainPtr<CFGAS_GEFont> LoadFont( std::unique_ptr<CFX_Font> pInternalFont, CFGAS_FontMgr* pFontMgr); - CFX_RetainPtr<CFGAS_GEFont> Derive(uint32_t dwFontStyles, - uint16_t wCodePage = 0); + RetainPtr<CFGAS_GEFont> Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); uint32_t GetFontStyles() const; bool GetCharWidth(wchar_t wUnicode, int32_t& iWidth, bool bCharCode); int32_t GetGlyphIndex(wchar_t wUnicode, bool bCharCode = false); @@ -48,7 +47,7 @@ class CFGAS_GEFont : public CFX_Retainable { int32_t GetDescent() const; bool GetCharBBox(wchar_t wUnicode, CFX_Rect* bbox, bool bCharCode = false); bool GetBBox(CFX_Rect* bbox); - CFX_RetainPtr<CFGAS_GEFont> GetSubstFont(int32_t iGlyphIndex); + RetainPtr<CFGAS_GEFont> GetSubstFont(int32_t iGlyphIndex); CFX_Font* GetDevFont() const { return m_pFont; } void SetFontProvider(CFGAS_PDFFontMgr* pProvider) { m_pProvider.Reset(pProvider); @@ -62,7 +61,7 @@ class CFGAS_GEFont : public CFX_Retainable { private: explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr); - CFGAS_GEFont(const CFX_RetainPtr<CFGAS_GEFont>& src, uint32_t dwFontStyles); + CFGAS_GEFont(const RetainPtr<CFGAS_GEFont>& src, uint32_t dwFontStyles); ~CFGAS_GEFont() override; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -70,9 +69,8 @@ class CFGAS_GEFont : public CFX_Retainable { uint32_t dwFontStyles, uint16_t wCodePage); bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); - bool LoadFontInternal( - const CFX_RetainPtr<CFX_SeekableStreamProxy>& pFontStream, - bool bSaveStream); + bool LoadFontInternal(const RetainPtr<CFX_SeekableStreamProxy>& pFontStream, + bool bSaveStream); #endif bool LoadFontInternal(CFX_Font* pExternalFont); bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); @@ -87,7 +85,7 @@ class CFGAS_GEFont : public CFX_Retainable { bool bCharCode); int32_t GetGlyphIndex(wchar_t wUnicode, bool bRecursive, - CFX_RetainPtr<CFGAS_GEFont>* ppFont, + RetainPtr<CFGAS_GEFont>* ppFont, bool bCharCode = false); WideString GetFamilyName() const; @@ -97,16 +95,16 @@ class CFGAS_GEFont : public CFX_Retainable { #endif CFX_Font* m_pFont; bool m_bExternalFont; - CFX_RetainPtr<CFGAS_GEFont> m_pSrcFont; // Only set by ctor, so no cycles. + RetainPtr<CFGAS_GEFont> m_pSrcFont; // Only set by ctor, so no cycles. CFGAS_FontMgr::ObservedPtr m_pFontMgr; CFGAS_PDFFontMgr::ObservedPtr m_pProvider; - CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; - CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; + RetainPtr<CFX_SeekableStreamProxy> m_pStream; + RetainPtr<IFX_SeekableReadStream> m_pFileRead; std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; std::map<wchar_t, int32_t> m_CharWidthMap; std::map<wchar_t, CFX_Rect> m_BBoxMap; - std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_SubstFonts; - std::map<wchar_t, CFX_RetainPtr<CFGAS_GEFont>> m_FontMapper; + std::vector<RetainPtr<CFGAS_GEFont>> m_SubstFonts; + std::map<wchar_t, RetainPtr<CFGAS_GEFont>> m_FontMapper; }; #endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_ diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp index 2b8e30e5ee..0fd18aa9b9 100644 --- a/xfa/fgas/font/cfgas_pdffontmgr.cpp +++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp @@ -32,12 +32,11 @@ CFGAS_PDFFontMgr::CFGAS_PDFFontMgr(CPDF_Document* pDoc, CFGAS_FontMgr* pFontMgr) CFGAS_PDFFontMgr::~CFGAS_PDFFontMgr() {} -CFX_RetainPtr<CFGAS_GEFont> CFGAS_PDFFontMgr::FindFont( - const ByteString& strPsName, - bool bBold, - bool bItalic, - CPDF_Font** pDstPDFFont, - bool bStrictMatch) { +RetainPtr<CFGAS_GEFont> CFGAS_PDFFontMgr::FindFont(const ByteString& strPsName, + bool bBold, + bool bItalic, + CPDF_Font** pDstPDFFont, + bool bStrictMatch) { CPDF_Dictionary* pFontSetDict = m_pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR"); if (!pFontSetDict) @@ -73,7 +72,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_PDFFontMgr::FindFont( return nullptr; } -CFX_RetainPtr<CFGAS_GEFont> CFGAS_PDFFontMgr::GetFont( +RetainPtr<CFGAS_GEFont> CFGAS_PDFFontMgr::GetFont( const WideStringView& wsFontFamily, uint32_t dwFontStyles, CPDF_Font** pPDFFont, @@ -89,7 +88,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_PDFFontMgr::GetFont( bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold; bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic; ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic); - CFX_RetainPtr<CFGAS_GEFont> pFont = + RetainPtr<CFGAS_GEFont> pFont = FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch); if (pFont) m_FontMap[strKey] = pFont; @@ -185,7 +184,7 @@ bool CFGAS_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName, return true; } -bool CFGAS_PDFFontMgr::GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont, +bool CFGAS_PDFFontMgr::GetCharWidth(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wUnicode, bool bCharCode, int32_t* pWidth) { @@ -201,7 +200,7 @@ bool CFGAS_PDFFontMgr::GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont, return true; } -void CFGAS_PDFFontMgr::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, +void CFGAS_PDFFontMgr::SetFont(const RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont) { m_FDE2PDFFont[pFont] = pPDFFont; } diff --git a/xfa/fgas/font/cfgas_pdffontmgr.h b/xfa/fgas/font/cfgas_pdffontmgr.h index a31d865cec..1f7d49a4e7 100644 --- a/xfa/fgas/font/cfgas_pdffontmgr.h +++ b/xfa/fgas/font/cfgas_pdffontmgr.h @@ -11,9 +11,9 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/observable.h" +#include "core/fxcrt/retain_ptr.h" class CFGAS_FontMgr; class CFGAS_GEFont; @@ -25,22 +25,22 @@ class CFGAS_PDFFontMgr : public Observable<CFGAS_PDFFontMgr> { explicit CFGAS_PDFFontMgr(CPDF_Document* pDoc, CFGAS_FontMgr* pFontMgr); ~CFGAS_PDFFontMgr(); - CFX_RetainPtr<CFGAS_GEFont> GetFont(const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - CPDF_Font** pPDFFont, - bool bStrictMatch); - bool GetCharWidth(const CFX_RetainPtr<CFGAS_GEFont>& pFont, + RetainPtr<CFGAS_GEFont> GetFont(const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + CPDF_Font** pPDFFont, + bool bStrictMatch); + bool GetCharWidth(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wUnicode, bool bCharCode, int32_t* pWidth); - void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont); + void SetFont(const RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont); private: - CFX_RetainPtr<CFGAS_GEFont> FindFont(const ByteString& strFamilyName, - bool bBold, - bool bItalic, - CPDF_Font** pPDFFont, - bool bStrictMatch); + RetainPtr<CFGAS_GEFont> FindFont(const ByteString& strFamilyName, + bool bBold, + bool bItalic, + CPDF_Font** pPDFFont, + bool bStrictMatch); ByteString PsNameToFontName(const ByteString& strPsName, bool bBold, bool bItalic); @@ -52,8 +52,8 @@ class CFGAS_PDFFontMgr : public Observable<CFGAS_PDFFontMgr> { CFX_UnownedPtr<CPDF_Document> const m_pDoc; CFX_UnownedPtr<CFGAS_FontMgr> const m_pFontMgr; - std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont; - std::map<ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap; + std::map<RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont; + std::map<ByteString, RetainPtr<CFGAS_GEFont>> m_FontMap; }; #endif // XFA_FGAS_FONT_CFGAS_PDFFONTMGR_H_ diff --git a/xfa/fgas/layout/cfx_break.cpp b/xfa/fgas/layout/cfx_break.cpp index 52236f3176..5c5569ad44 100644 --- a/xfa/fgas/layout/cfx_break.cpp +++ b/xfa/fgas/layout/cfx_break.cpp @@ -73,7 +73,7 @@ void CFX_Break::SetVerticalScale(int32_t iScale) { m_iVerticalScale = iScale; } -void CFX_Break::SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont) { +void CFX_Break::SetFont(const RetainPtr<CFGAS_GEFont>& pFont) { if (!pFont || pFont == m_pFont) return; diff --git a/xfa/fgas/layout/cfx_break.h b/xfa/fgas/layout/cfx_break.h index b45924e1e7..322fa2be8e 100644 --- a/xfa/fgas/layout/cfx_break.h +++ b/xfa/fgas/layout/cfx_break.h @@ -9,7 +9,7 @@ #include <stdint.h> -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/layout/cfx_breakline.h" @@ -37,7 +37,7 @@ class CFX_Break { void SetLayoutStyles(uint32_t dwLayoutStyles); uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; } - void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont); + void SetFont(const RetainPtr<CFGAS_GEFont>& pFont); void SetFontSize(float fFontSize); void SetTabWidth(float fTabWidth); int32_t GetTabWidth() const { return m_iTabWidth; } @@ -80,7 +80,7 @@ class CFX_Break { int32_t m_iCharSpace; int32_t m_iDefChar; wchar_t m_wDefChar; - CFX_RetainPtr<CFGAS_GEFont> m_pFont; + RetainPtr<CFGAS_GEFont> m_pFont; CFX_BreakLine m_Line[2]; CFX_BreakLine* m_pCurLine; int8_t m_iReadyLineIndex; diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h index bbf4558eb1..1109e2296b 100644 --- a/xfa/fgas/layout/cfx_breakpiece.h +++ b/xfa/fgas/layout/cfx_breakpiece.h @@ -10,9 +10,9 @@ #include <vector> #include "core/fxcrt/cfx_char.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/retain_ptr.h" #include "xfa/fxfa/cxfa_textuserdata.h" class CFX_BreakPiece { @@ -41,7 +41,7 @@ class CFX_BreakPiece { uint32_t m_dwIdentity; uint32_t m_dwCharStyles; CFX_UnownedPtr<std::vector<CFX_Char>> m_pChars; - CFX_RetainPtr<CXFA_TextUserData> m_pUserData; + RetainPtr<CXFA_TextUserData> m_pUserData; }; #endif // XFA_FGAS_LAYOUT_CFX_BREAKPIECE_H_ diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp index be5780fc7a..8768aa34ff 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak.cpp @@ -41,8 +41,7 @@ void CFX_RTFBreak::AddPositionedTab(float fTabPos) { m_PositionedTabs.insert(it, iTabPos); } -void CFX_RTFBreak::SetUserData( - const CFX_RetainPtr<CXFA_TextUserData>& pUserData) { +void CFX_RTFBreak::SetUserData(const RetainPtr<CXFA_TextUserData>& pUserData) { if (m_pUserData == pUserData) return; @@ -668,7 +667,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, ASSERT(pText->pFont && pText->pRect); - CFX_RetainPtr<CFGAS_GEFont> pFont = pText->pFont; + RetainPtr<CFGAS_GEFont> pFont = pText->pFont; CFX_RectF rtText(*pText->pRect); bool bRTLPiece = FX_IsOdd(pText->iBidiLevel); float fFontSize = pText->fFontSize; diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h index f5ad90838f..5a3f4313b5 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.h +++ b/xfa/fgas/layout/cfx_rtfbreak.h @@ -10,9 +10,9 @@ #include <deque> #include <vector> -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_unicode.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_renderdevice.h" #include "xfa/fgas/layout/cfx_break.h" #include "xfa/fxfa/cxfa_textuserdata.h" @@ -33,7 +33,7 @@ struct FX_RTFTEXTOBJ { WideString pStr; std::vector<int32_t> pWidths; - CFX_RetainPtr<CFGAS_GEFont> pFont; + RetainPtr<CFGAS_GEFont> pFont; const CFX_RectF* pRect; wchar_t wLineBreakChar; float fFontSize; @@ -51,7 +51,7 @@ class CFX_RTFBreak : public CFX_Break { void SetLineStartPos(float fLinePos); void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; } - void SetUserData(const CFX_RetainPtr<CXFA_TextUserData>& pUserData); + void SetUserData(const RetainPtr<CXFA_TextUserData>& pUserData); void AddPositionedTab(float fTabPos); @@ -92,7 +92,7 @@ class CFX_RTFBreak : public CFX_Break { bool m_bPagination; std::vector<int32_t> m_PositionedTabs; CFX_RTFLineAlignment m_iAlignment; - CFX_RetainPtr<CXFA_TextUserData> m_pUserData; + RetainPtr<CXFA_TextUserData> m_pUserData; }; #endif // XFA_FGAS_LAYOUT_CFX_RTFBREAK_H_ diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp index bda52fc76a..5f24631315 100644 --- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp @@ -30,7 +30,7 @@ class CFX_RTFBreakTest : public testing::Test { } private: - CFX_RetainPtr<CFGAS_GEFont> font_; + RetainPtr<CFGAS_GEFont> font_; }; // As soon as you get one of the control characters the break is complete diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp index 9fe5a432f6..403b7e6c11 100644 --- a/xfa/fgas/layout/cfx_txtbreak.cpp +++ b/xfa/fgas/layout/cfx_txtbreak.cpp @@ -651,7 +651,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, const wchar_t* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength - 1; - CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; + RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; uint32_t dwStyles = pTxtRun->dwStyles; CFX_RectF rtText(*pTxtRun->pRect); bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; @@ -909,7 +909,7 @@ std::vector<CFX_RectF> CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, float fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); float fScale = fFontSize / 1000.0f; - CFX_RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; + RetainPtr<CFGAS_GEFont> pFont = pTxtRun->pFont; if (!pFont) bCharBBox = false; diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h index 959cd8eb48..e6f8da03d2 100644 --- a/xfa/fgas/layout/cfx_txtbreak.h +++ b/xfa/fgas/layout/cfx_txtbreak.h @@ -44,7 +44,7 @@ struct FX_TXTRUN { WideString wsStr; int32_t* pWidths; int32_t iLength; - CFX_RetainPtr<CFGAS_GEFont> pFont; + RetainPtr<CFGAS_GEFont> pFont; float fFontSize; uint32_t dwStyles; int32_t iHorizontalScale; |