diff --git a/PdfFile/PdfEditor.cpp b/PdfFile/PdfEditor.cpp index bc6114f0b0..8bc470e8a3 100644 --- a/PdfFile/PdfEditor.cpp +++ b/PdfFile/PdfEditor.cpp @@ -1110,7 +1110,7 @@ bool CPdfEditor::EditAnnot(int nPageIndex, int nID) pAnnot = new PdfWriter::CPolygonLineAnnotation(pXref); else if (oType.isName("FreeText")) { - std::map mapFont = pReader->AnnotFonts(&oAnnotRef); + std::map mapFont = pReader->GetAnnotFonts(&oAnnotRef); m_mFonts.insert(mapFont.begin(), mapFont.end()); pAnnot = new PdfWriter::CFreeTextAnnotation(pXref); } diff --git a/PdfFile/PdfReader.cpp b/PdfFile/PdfReader.cpp index 677b44ff6c..a0c4f7bb4f 100644 --- a/PdfFile/PdfReader.cpp +++ b/PdfFile/PdfReader.cpp @@ -981,7 +981,7 @@ BYTE* CPdfReader::GetWidgets() oRes.ClearWithoutAttack(); return bRes; } -std::map CPdfReader::AnnotFonts(Object* pRefAnnot) +std::map CPdfReader::GetAnnotFonts(Object* pRefAnnot) { return PdfReader::AnnotMarkup::SetFont(m_pPDFDocument, pRefAnnot, m_pFontManager, m_pFontList, 3); } diff --git a/PdfFile/PdfReader.h b/PdfFile/PdfReader.h index 36d14ae5d4..3cf92ad79e 100644 --- a/PdfFile/PdfReader.h +++ b/PdfFile/PdfReader.h @@ -82,7 +82,7 @@ public: BYTE* GetAPWidget (int nRasterW, int nRasterH, int nBackgroundColor, int nPageIndex, int nWidget = -1, const char* sView = NULL, const char* sBView = NULL); BYTE* GetAPAnnots (int nRasterW, int nRasterH, int nBackgroundColor, int nPageIndex, int nAnnot = -1, const char* sView = NULL); BYTE* GetButtonIcon(int nBackgroundColor, int nPageIndex, bool bBase64 = false, int nBWidget = -1, const char* sIView = NULL); - std::map AnnotFonts(Object* pRefAnnot); + std::map GetAnnotFonts(Object* pRefAnnot); private: PDFDoc* m_pPDFDocument; diff --git a/PdfFile/SrcReader/PdfAnnot.cpp b/PdfFile/SrcReader/PdfAnnot.cpp index fa5dcceabe..7a19c8c809 100644 --- a/PdfFile/SrcReader/PdfAnnot.cpp +++ b/PdfFile/SrcReader/PdfAnnot.cpp @@ -2444,9 +2444,10 @@ std::map AnnotMarkup::SetFont(PDFDoc* pdfDoc, Object continue; std::string sFontName = arrRC[i]->sFontFamily; + std::wstring wsFontName = UTF8_TO_U(sFontName); bool bBold = (bool)((arrRC[i]->unFontFlags >> 0) & 1); bool bItalic = (bool)((arrRC[i]->unFontFlags >> 1) & 1); - bool bBase = sFontName == "Courier" || sFontName == "Helvetica" || sFontName == "Symbol" || sFontName == "Times New Roman" || sFontName == "ZapfDingbats"; + bool bBase = isBaseFont(wsFontName) || sFontName == "Times New Roman"; if ((nTypeFonts & 2) && bBase) { if (sFontName == "Times New Roman") @@ -2472,7 +2473,6 @@ std::map AnnotMarkup::SetFont(PDFDoc* pdfDoc, Object const unsigned char* pData14 = NULL; unsigned int nSize14 = 0; - std::wstring wsFontName = UTF8_TO_U(sFontName); if (!NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage()->Get(wsFontName) && GetBaseFont(wsFontName, pData14, nSize14)) NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage()->Add(wsFontName, (BYTE*)pData14, nSize14, false); std::string sFontNameBefore = arrRC[i]->sFontFamily; @@ -2496,7 +2496,7 @@ std::map AnnotMarkup::SetFont(PDFDoc* pdfDoc, Object oFontSelect.bBold = new INT(1); if (bItalic) oFontSelect.bItalic = new INT(1); - oFontSelect.wsName = new std::wstring(UTF8_TO_U(sFontName)); + oFontSelect.wsName = new std::wstring(wsFontName); NSFonts::CFontInfo* pFontInfo = pAppFontList->GetByParams(oFontSelect); if (pFontInfo && !pFontInfo->m_wsFontPath.empty())