From 47545693813253ef21379926ecd2d054e40b07db Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Wed, 28 May 2025 11:51:47 +0300 Subject: [PATCH] Fix bug 74727 --- PdfFile/PdfReader.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/PdfFile/PdfReader.cpp b/PdfFile/PdfReader.cpp index 96f422e841..7e568107e8 100644 --- a/PdfFile/PdfReader.cpp +++ b/PdfFile/PdfReader.cpp @@ -361,6 +361,12 @@ bool CPdfReader::IsNeedCMap() void CPdfReader::SetCMapMemory(BYTE* pData, DWORD nSizeData) { ((GlobalParamsAdaptor*)globalParams)->SetCMapMemory(pData, nSizeData); + + if (m_vPDFContext.empty()) + return; + CPdfReaderContext* pPDFContext = m_vPDFContext.back(); + std::map mFonts = PdfReader::CAnnotFonts::GetAllFonts(pPDFContext->m_pDocument, m_pFontManager, pPDFContext->m_pFontList); + m_mFonts.insert(mFonts.begin(), mFonts.end()); } void CPdfReader::SetCMapFolder(const std::wstring& sFolder) { @@ -616,8 +622,11 @@ bool CPdfReader::MergePages(BYTE* pData, DWORD nLength, const std::wstring& wsPa return false; } - std::map mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList); - m_mFonts.insert(mFonts.begin(), mFonts.end()); + if (!IsNeedCMap()) + { + std::map mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList); + m_mFonts.insert(mFonts.begin(), mFonts.end()); + } return true; } @@ -652,8 +661,11 @@ bool CPdfReader::MergePages(const std::wstring& wsFile, const std::wstring& wsPa return false; } - std::map mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList); - m_mFonts.insert(mFonts.begin(), mFonts.end()); + if (!IsNeedCMap()) + { + std::map mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList); + m_mFonts.insert(mFonts.begin(), mFonts.end()); + } return true; }