mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix bug 75102
This commit is contained in:
@ -370,7 +370,7 @@ void CPdfReader::SetCMapMemory(BYTE* pData, DWORD nSizeData)
|
||||
if (m_vPDFContext.empty())
|
||||
return;
|
||||
CPdfReaderContext* pPDFContext = m_vPDFContext.back();
|
||||
std::map<std::wstring, std::wstring> mFonts = PdfReader::CAnnotFonts::GetAllFonts(pPDFContext->m_pDocument, m_pFontManager, pPDFContext->m_pFontList);
|
||||
std::map<std::wstring, std::wstring> mFonts = PdfReader::CAnnotFonts::GetAllFonts(pPDFContext->m_pDocument, m_pFontManager, pPDFContext->m_pFontList, false);
|
||||
m_mFonts.insert(mFonts.begin(), mFonts.end());
|
||||
}
|
||||
void CPdfReader::SetCMapFolder(const std::wstring& sFolder)
|
||||
@ -638,11 +638,8 @@ bool CPdfReader::MergePages(BYTE* pData, DWORD nLength, const std::wstring& wsPa
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsNeedCMap())
|
||||
{
|
||||
std::map<std::wstring, std::wstring> mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList);
|
||||
m_mFonts.insert(mFonts.begin(), mFonts.end());
|
||||
}
|
||||
std::map<std::wstring, std::wstring> mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList, IsNeedCMap());
|
||||
m_mFonts.insert(mFonts.begin(), mFonts.end());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -677,11 +674,8 @@ bool CPdfReader::MergePages(const std::wstring& wsFile, const std::wstring& wsPa
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsNeedCMap())
|
||||
{
|
||||
std::map<std::wstring, std::wstring> mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList);
|
||||
m_mFonts.insert(mFonts.begin(), mFonts.end());
|
||||
}
|
||||
std::map<std::wstring, std::wstring> mFonts = PdfReader::CAnnotFonts::GetAllFonts(pDoc, m_pFontManager, pContext->m_pFontList, IsNeedCMap());
|
||||
m_mFonts.insert(mFonts.begin(), mFonts.end());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -527,7 +527,7 @@ bool CAnnotFonts::IsBaseFont(const std::wstring& wsName)
|
||||
wsName == L"Helvetica-Oblique" || wsName == L"Symbol" || wsName == L"Times-Bold" || wsName == L"Times-BoldItalic" ||
|
||||
wsName == L"Times-Italic" || wsName == L"Times-Roman" || wsName == L"ZapfDingbats";
|
||||
}
|
||||
std::map<std::wstring, std::wstring> CAnnotFonts::GetAllFonts(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList)
|
||||
std::map<std::wstring, std::wstring> CAnnotFonts::GetAllFonts(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, bool bIsNeedCMap)
|
||||
{
|
||||
std::map<std::wstring, std::wstring> mFonts;
|
||||
|
||||
@ -569,7 +569,7 @@ std::map<std::wstring, std::wstring> CAnnotFonts::GetAllFonts(PDFDoc* pdfDoc, NS
|
||||
std::string sActualFontName;
|
||||
std::wstring wsFileName;
|
||||
bool bBold = false, bItalic = false;
|
||||
wsFileName = GetFontData(pdfDoc, pFontManager, pFontList, &oFontRef, sFontName, sActualFontName, bBold, bItalic);
|
||||
wsFileName = GetFontData(pdfDoc, pFontManager, pFontList, &oFontRef, sFontName, sActualFontName, bBold, bItalic, bIsNeedCMap);
|
||||
|
||||
if (!sActualFontName.empty())
|
||||
{
|
||||
@ -593,7 +593,7 @@ std::map<std::wstring, std::wstring> CAnnotFonts::GetAllFonts(PDFDoc* pdfDoc, NS
|
||||
std::string sFontKey;
|
||||
if (GetFontFromAP(pdfDoc, pField, &oFontRef, sFontKey) && std::find(arrUniqueFontsRef.begin(), arrUniqueFontsRef.end(), oFontRef.getRefNum()) == arrUniqueFontsRef.end())
|
||||
{
|
||||
wsFileName = GetFontData(pdfDoc, pFontManager, pFontList, &oFontRef, sFontName, sActualFontName, bBold, bItalic);
|
||||
wsFileName = GetFontData(pdfDoc, pFontManager, pFontList, &oFontRef, sFontName, sActualFontName, bBold, bItalic, bIsNeedCMap);
|
||||
|
||||
std::wstring wsFontName = UTF8_TO_U(sFontName);
|
||||
if (sActualFontName.empty() && mFonts.find(wsFontName) == mFonts.end())
|
||||
@ -680,7 +680,7 @@ std::map<std::wstring, std::wstring> CAnnotFonts::GetAllFonts(PDFDoc* pdfDoc, NS
|
||||
|
||||
return mFonts;
|
||||
}
|
||||
std::wstring CAnnotFonts::GetFontData(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oFontRef, std::string& sFontName, std::string& sActualFontName, bool& bBold, bool& bItalic)
|
||||
std::wstring CAnnotFonts::GetFontData(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oFontRef, std::string& sFontName, std::string& sActualFontName, bool& bBold, bool& bItalic, bool bIsNeedCMap)
|
||||
{
|
||||
bBold = false, bItalic = false;
|
||||
XRef* xref = pdfDoc->getXRef();
|
||||
|
||||
@ -658,8 +658,8 @@ class CAnnotFonts final
|
||||
{
|
||||
public:
|
||||
static bool IsBaseFont(const std::wstring& wsName);
|
||||
static std::map<std::wstring, std::wstring> GetAllFonts(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList);
|
||||
static std::wstring GetFontData(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oFontRef, std::string& sFontName, std::string& sActualFontName, bool& bBold, bool& bItalic);
|
||||
static std::map<std::wstring, std::wstring> GetAllFonts(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, bool bIsNeedCMap);
|
||||
static std::wstring GetFontData(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oFontRef, std::string& sFontName, std::string& sActualFontName, bool& bBold, bool& bItalic, bool bIsNeedCMap = false);
|
||||
static bool GetFontFromAP(PDFDoc* pdfDoc, AcroFormField* pField, Object* oFontRef, std::string& sFontKey);
|
||||
static std::map<std::wstring, std::wstring> GetAnnotFont(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList *pFontList, Object* oAnnotRef);
|
||||
static std::map<std::wstring, std::wstring> GetFreeTextFont(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, CPdfFontList* pFontList, Object* oAnnotRef, std::vector<CAnnotMarkup::CFontData*>& arrRC);
|
||||
|
||||
Reference in New Issue
Block a user