--- /dev/null
+From 85c0dff3422fa3c26fbc2e8d8561f597ec24bd92 Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Wed, 2 Feb 2022 23:12:52 +0000
+Subject: [PATCH] #16734: Build break with poppler 22.2.0
+
+git-svn-id: svn://scribus.net/trunk/Scribus@24884 11d20701-8431-0410-a711-e3c959e3b870
+---
+ scribus/plugins/import/pdf/slaoutput.cpp | 47 +++++++++++++++++++-----
+ 1 file changed, 37 insertions(+), 10 deletions(-)
+
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+index 5894bf2ad6..3650c96f52 100644
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -7,6 +7,11 @@ for which a new license (GPL+exception) is in place.
+ \r
+ #include "slaoutput.h"\r
+ \r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++#include <memory>\r
++#include <optional>\r
++#endif\r
++\r
+ #include <poppler/GlobalParams.h>\r
+ #include <poppler/poppler-config.h>\r
+ #include <poppler/FileSpec.h>\r
+@@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
+ void SlaOutputDev::updateFont(GfxState *state)\r
+ {\r
+ GfxFont *gfxFont;\r
+- GfxFontLoc *fontLoc;\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++ std::optional<GfxFontLoc> fontLoc;\r
++ const GooString * fileName = nullptr;\r
++ std::unique_ptr<FoFiTrueType> ff;\r
++#else\r
++ GfxFontLoc * fontLoc = nullptr;\r
++ GooString * fileName = nullptr;\r
++ FoFiTrueType * ff = nullptr;\r
++#endif\r
+ GfxFontType fontType;\r
+ SlaOutFontFileID *id;\r
+ SplashFontFile *fontFile;\r
+ SplashFontSrc *fontsrc = nullptr;\r
+- FoFiTrueType *ff;\r
+ Object refObj, strObj;\r
+- GooString *fileName;\r
+- char *tmpBuf;\r
++ char *tmpBuf = nullptr;\r
+ int tmpBufLen = 0;\r
+- int *codeToGID;\r
+- const double *textMat;\r
++ int *codeToGID = nullptr;\r
++ const double *textMat = nullptr;\r
+ double m11, m12, m21, m22, fontSize;\r
+ SplashCoord mat[4];\r
+ int n = 0;\r
+@@ -3046,9 +3057,6 @@ void SlaOutputDev::updateFont(GfxState *state)
+ SplashCoord matrix[6];\r
+ \r
+ m_font = nullptr;\r
+- fileName = nullptr;\r
+- tmpBuf = nullptr;\r
+- fontLoc = nullptr;\r
+ \r
+ gfxFont = state->getFont();\r
+ if (!gfxFont)\r
+@@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state)
+ }\r
+ else\r
+ { // gfxFontLocExternal\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++ fileName = fontLoc->pathAsGooString();\r
++#else\r
+ fileName = fontLoc->path;\r
++#endif\r
+ fontType = fontLoc->fontType;\r
+ }\r
+ \r
+@@ -3136,9 +3148,14 @@ void SlaOutputDev::updateFont(GfxState *state)
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r
+ if (ff)\r
+ {\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++ codeToGID = ((Gfx8BitFont*) gfxFont)->getCodeToGIDMap(ff.get());\r
++ ff.reset();\r
++#else\r
+ codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);\r
+- n = 256;\r
+ delete ff;\r
++#endif\r
++ n = 256;\r
+ }\r
+ else\r
+ {\r
+@@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state)
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r
+ if (! ff)\r
+ goto err2;\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++ codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);\r
++ ff.reset();\r
++#else\r
+ codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);\r
+ delete ff;\r
++#endif\r
+ }\r
+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(\r
+ id,\r
+@@ -3247,14 +3269,19 @@ void SlaOutputDev::updateFont(GfxState *state)
+ mat[3] = -m22;\r
+ m_font = m_fontEngine->getFont(fontFile, mat, matrix);\r
+ \r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)\r
+ delete fontLoc;\r
++#endif\r
+ if (fontsrc && !fontsrc->isFile)\r
+ fontsrc->unref();\r
+ return;\r
+ \r
+ err2:\r
+ delete id;\r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)\r
+ delete fontLoc;\r
++#endif\r
++\r
+ err1:\r
+ if (fontsrc && !fontsrc->isFile)\r
+ fontsrc->unref();\r
+From f75c1613db67f4067643d0218a2db3235e42ec9f Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Thu, 3 Feb 2022 19:46:13 +0000
+Subject: [PATCH] Small update vs latest code in poppler
+
+git-svn-id: svn://scribus.net/trunk/Scribus@24885 11d20701-8431-0410-a711-e3c959e3b870
+---
+ scribus/plugins/import/pdf/slaoutput.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+index 3650c96f52..a6f4e00fa9 100644
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -3072,10 +3072,10 @@ void SlaOutputDev::updateFont(GfxState *state)
+ delete id;\r
+ else\r
+ {\r
+- if (!(fontLoc = gfxFont->locateFont(xref, nullptr)))\r
++ fontLoc = gfxFont->locateFont((xref) ? xref : pdfDoc->getXRef(), nullptr);\r
++ if (!fontLoc)\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ \r
+From f19410ac3b27e33dd62105746784e61e85b90a1d Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Wed, 2 Mar 2022 22:22:53 +0000
+Subject: [PATCH] #16764: Build break with poppler 22.03.0
+
+git-svn-id: svn://scribus.net/trunk/Scribus@24982 11d20701-8431-0410-a711-e3c959e3b870
+---
+ scribus/plugins/import/pdf/importpdf.cpp | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
+index 154e58a3f0..392dcd9e64 100644
+--- a/scribus/plugins/import/pdf/importpdf.cpp
++++ b/scribus/plugins/import/pdf/importpdf.cpp
+@@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName)
+ #endif\r
+ globalParams->setErrQuiet(gTrue);\r
+ \r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r
++ PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };\r
++#else\r
+ PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};\r
++#endif\r
+ if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)\r
+ return QImage();\r
+ \r
+@@ -342,7 +346,11 @@ bool PdfPlug::convert(const QString& fn)
+ globalParams->setErrQuiet(gTrue);\r
+ // globalParams->setPrintCommands(gTrue);\r
+ QList<OptionalContentGroup*> ocgGroups;\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r
++ auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));\r
++#else\r
+ auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr, nullptr, nullptr));\r
++#endif\r
+ if (pdfDoc)\r
+ {\r
+ if (pdfDoc->getErrorCode() == errEncrypted)\r
+@@ -361,8 +369,13 @@ bool PdfPlug::convert(const QString& fn)
+ #else\r
+ auto fname = new GooString(QFile::encodeName(fn).data());\r
+ #endif\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r
++ std::optional<GooString> userPW(std::in_place, text.toLocal8Bit().data());\r
++ pdfDoc.reset(new PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));\r
++#else\r
+ auto userPW = new GooString(text.toLocal8Bit().data());\r
+ pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr));\r
++#endif\r
+ qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));\r
+ }\r
+ if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone))\r
+From f2237b8f0b5cf7690e864a22ef7a63a6d769fa36 Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Fri, 1 Apr 2022 23:52:32 +0000
+Subject: [PATCH] Fix build with poppler 22.04.0
+
+git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870
+---
+ scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++---------
+ 1 file changed, 78 insertions(+), 45 deletions(-)
+
+From e013e8126d2100e8e56dea5b836ad43275429389 Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Wed, 2 Mar 2022 22:48:29 +0000
+Subject: [PATCH] Enforce poppler version >= 0.86.0
+
+git-svn-id: svn://scribus.net/trunk/Scribus@24985 11d20701-8431-0410-a711-e3c959e3b870
+---
+ cmake/modules/Findpoppler.cmake | 4 +-
+ scribus/plugins/import/pdf/importpdf.cpp | 65 ++-----------
+ scribus/plugins/import/pdf/slaoutput.cpp | 114 -----------------------
+ scribus/plugins/import/pdf/slaoutput.h | 7 --
+ 4 files changed, 10 insertions(+), 180 deletions(-)
+
+diff --git a/cmake/modules/Findpoppler.cmake b/cmake/modules/Findpoppler.cmake
+index 56ce613ae9..9cab5532ab 100644
+--- a/cmake/modules/Findpoppler.cmake
++++ b/cmake/modules/Findpoppler.cmake
+@@ -1,8 +1,8 @@
+ #include(FindPkgConfig)
+ find_package(PkgConfig QUIET)
+-pkg_search_module(poppler libpoppler>=0.62.0 poppler>=0.62.0)
++pkg_search_module(poppler libpoppler>=0.86.0 poppler>=0.86.0)
+ if (poppler_FOUND)
+- pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.62.0 poppler-cpp>=0.62.0)
++ pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.86.0 poppler-cpp>=0.86.0)
+ endif(poppler_FOUND)
+
+ find_path(poppler_INCLUDE_DIR
+diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
+index 392dcd9e64..970a1a37ca 100644
+--- a/scribus/plugins/import/pdf/importpdf.cpp
++++ b/scribus/plugins/import/pdf/importpdf.cpp
+@@ -74,20 +74,15 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
+ \r
+ QImage PdfPlug::readThumbnail(const QString& fName)\r
+ {\r
+- QString pdfFile = QDir::toNativeSeparators(fName);\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r
+ globalParams.reset(new GlobalParams());\r
+-#else\r
+- std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());\r
+- globalParams = globalParamsPtr.get();\r
+-#endif\r
++ globalParams->setErrQuiet(gTrue);\r
+ \r
+-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r
++ QString pdfFile = QDir::toNativeSeparators(fName);\r
++#if defined(Q_OS_WIN32)\r
+ auto fname = new GooString(pdfFile.toUtf8().data());\r
+ #else\r
+ auto fname = new GooString(QFile::encodeName(pdfFile).data());\r
+ #endif\r
+- globalParams->setErrQuiet(gTrue);\r
+ \r
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r
+ PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };\r
+@@ -332,19 +327,15 @@ bool PdfPlug::convert(const QString& fn)
+ qApp->processEvents();\r
+ }\r
+ \r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r
+ globalParams.reset(new GlobalParams());\r
+-#else\r
+- std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());\r
+- globalParams = globalParamsPtr.get();\r
+-#endif\r
+-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r
++ globalParams->setErrQuiet(gTrue);\r
++\r
++#if defined(Q_OS_WIN32)\r
+ auto fname = new GooString(fn.toUtf8().data());\r
+ #else\r
+ auto fname = new GooString(QFile::encodeName(fn).data());\r
+ #endif\r
+- globalParams->setErrQuiet(gTrue);\r
+-// globalParams->setPrintCommands(gTrue);\r
++\r
+ QList<OptionalContentGroup*> ocgGroups;\r
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r
+ auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));\r
+@@ -364,7 +355,7 @@ bool PdfPlug::convert(const QString& fn)
+ QString text = QInputDialog::getText(mw, tr("Open PDF-File"), tr("Password"), QLineEdit::Normal, "", &ok);\r
+ if (ok && !text.isEmpty())\r
+ {\r
+-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r
++#if defined(Q_OS_WIN32)\r
+ auto fname = new GooString(fn.toUtf8().data());\r
+ #else\r
+ auto fname = new GooString(QFile::encodeName(fn).data());\r
+@@ -382,9 +373,6 @@ bool PdfPlug::convert(const QString& fn)
+ {\r
+ if (m_progressDialog)\r
+ m_progressDialog->close();\r
+-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r
+- delete globalParams;\r
+-#endif\r
+ return false;\r
+ }\r
+ if (m_progressDialog)\r
+@@ -494,7 +482,6 @@ bool PdfPlug::convert(const QString& fn)
+ }\r
+ else\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)\r
+ const auto& ocgs = ocg->getOCGs ();\r
+ for (const auto& ocg : ocgs)\r
+ {\r
+@@ -506,25 +493,11 @@ bool PdfPlug::convert(const QString& fn)
+ ocgNames.append(ocgName);\r
+ }\r
+ }\r
+-#else\r
+- GooList *ocgs = ocg->getOCGs ();\r
+- for (int i = 0; i < ocgs->getLength (); ++i)\r
+- {\r
+- OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);\r
+- QString ocgName = UnicodeParsedString(oc->getName());\r
+- if (!ocgNames.contains(ocgName))\r
+- {\r
+- ocgGroups.prepend(oc);\r
+- ocgNames.append(ocgName);\r
+- }\r
+- }\r
+-#endif\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)\r
+ const auto& ocgs = ocg->getOCGs ();\r
+ for (const auto& ocg : ocgs)\r
+ {\r
+@@ -536,19 +509,6 @@ bool PdfPlug::convert(const QString& fn)
+ ocgNames.append(ocgName);\r
+ }\r
+ }\r
+-#else\r
+- GooList *ocgs = ocg->getOCGs ();\r
+- for (int i = 0; i < ocgs->getLength (); ++i)\r
+- {\r
+- OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);\r
+- QString ocgName = UnicodeParsedString(oc->getName());\r
+- if (!ocgNames.contains(ocgName))\r
+- {\r
+- ocgGroups.prepend(oc);\r
+- ocgNames.append(ocgName);\r
+- }\r
+- }\r
+-#endif\r
+ }\r
+ }\r
+ \r
+@@ -787,13 +747,8 @@ bool PdfPlug::convert(const QString& fn)
+ names = catDict.dictLookup("OpenAction");\r
+ if (names.isDict())\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkAction> linkActionUPtr = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());\r
+ LinkAction *linkAction = linkActionUPtr.get();\r
+-#else\r
+- LinkAction *linkAction = nullptr;\r
+- linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());\r
+-#endif\r
+ if (linkAction && (linkAction->getKind() == actionJavaScript))\r
+ {\r
+ LinkJavaScript *jsa = (LinkJavaScript*) linkAction;\r
+@@ -861,11 +816,7 @@ bool PdfPlug::convert(const QString& fn)
+ }\r
+ pdfDoc.reset();\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r
+ globalParams.reset();\r
+-#else\r
+- globalParams = nullptr;\r
+-#endif\r
+ \r
+ // qDebug() << "converting finished";\r
+ // qDebug() << "Imported" << m_elements.count() << "Elements";\r
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+index a6f4e00fa9..b6f2b8c219 100644
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -332,15 +332,9 @@ LinkAction* SlaOutputDev::SC_getAction(AnnotWidget *ano)
+ }\r
+ \r
+ /* Replacement for the crippled Poppler function LinkAction* AnnotWidget::getAdditionalAction(AdditionalActionsType type) */\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)\r
+ {\r
+ std::unique_ptr<LinkAction> linkAction;\r
+-#else\r
+-LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)\r
+-{\r
+- LinkAction *linkAction = nullptr;\r
+-#endif\r
+ Object obj;\r
+ Ref refa = ano->getRef();\r
+ \r
+@@ -467,11 +461,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
+ if (dst->isPageRef())\r
+ {\r
+ Ref dstr = dst->getPageRef();\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r
+ pagNum = pdfDoc->findPage(dstr);\r
+-#else\r
+- pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r
+-#endif\r
+ }\r
+ else\r
+ pagNum = dst->getPageNum();\r
+@@ -485,11 +475,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
+ POPPLER_CONST GooString *ndst = gto->getNamedDest();\r
+ if (ndst)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r
+-#else\r
+- LinkDest *dstn = pdfDoc->findDest(ndst);\r
+-#endif\r
+ if (dstn)\r
+ {\r
+ if (dstn->getKind() == destXYZ)\r
+@@ -497,11 +483,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
+ if (dstn->isPageRef())\r
+ {\r
+ Ref dstr = dstn->getPageRef();\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r
+ pagNum = pdfDoc->findPage(dstr);\r
+-#else\r
+- pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r
+-#endif\r
+ }\r
+ else\r
+ pagNum = dstn->getPageNum();\r
+@@ -533,11 +515,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
+ POPPLER_CONST GooString *ndst = gto->getNamedDest();\r
+ if (ndst)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r
+-#else\r
+- LinkDest *dstn = pdfDoc->findDest(ndst);\r
+-#endif\r
+ if (dstn)\r
+ {\r
+ if (dstn->getKind() == destXYZ)\r
+@@ -985,11 +963,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ if (dst->isPageRef())\r
+ {\r
+ Ref dstr = dst->getPageRef();\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r
+ pagNum = pdfDoc->findPage(dstr);\r
+-#else\r
+- pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r
+-#endif\r
+ }\r
+ else\r
+ pagNum = dst->getPageNum();\r
+@@ -1005,11 +979,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ POPPLER_CONST GooString *ndst = gto->getNamedDest();\r
+ if (ndst)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r
+-#else\r
+- LinkDest *dstn = pdfDoc->findDest(ndst);\r
+-#endif\r
+ if (dstn)\r
+ {\r
+ if (dstn->getKind() == destXYZ)\r
+@@ -1017,11 +987,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ if (dstn->isPageRef())\r
+ {\r
+ Ref dstr = dstn->getPageRef();\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r
+ pagNum = pdfDoc->findPage(dstr);\r
+-#else\r
+- pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r
+-#endif\r
+ }\r
+ else\r
+ pagNum = dstn->getPageNum();\r
+@@ -1061,11 +1027,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ POPPLER_CONST GooString *ndst = gto->getNamedDest();\r
+ if (ndst)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r
+-#else\r
+- LinkDest *dstn = pdfDoc->findDest(ndst);\r
+-#endif\r
+ if (dstn)\r
+ {\r
+ if (dstn->getKind() == destXYZ)\r
+@@ -1139,143 +1101,91 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setD_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("E", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setE_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("X", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setX_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("Fo", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setFo_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("Bl", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setBl_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("C", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setC_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("F", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setF_act(UnicodeParsedString(jsa->getScript()));\r
+@@ -1283,22 +1193,14 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ ite->annotation().setFormat(5);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("K", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setK_act(UnicodeParsedString(jsa->getScript()));\r
+@@ -1306,33 +1208,21 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+ ite->annotation().setFormat(5);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ Aact = SC_getAdditionalAction("V", ano);\r
+ if (Aact)\r
+ {\r
+ if (Aact->getKind() == actionJavaScript)\r
+ {\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r
+-#else\r
+- LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r
+-#endif\r
+ if (jsa->isOk())\r
+ {\r
+ ite->annotation().setV_act(UnicodeParsedString(jsa->getScript()));\r
+ ite->annotation().setAAact(true);\r
+ }\r
+ }\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ Aact.reset();\r
+-#else\r
+- Aact = nullptr;\r
+-#endif\r
+ }\r
+ }\r
+ \r
+@@ -1342,11 +1232,7 @@ void SlaOutputDev::startDoc(PDFDoc *doc, XRef *xrefA, Catalog *catA)
+ catalog = catA;\r
+ pdfDoc = doc;\r
+ updateGUICounter = 0;\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 84, 0)\r
+ m_fontEngine = new SplashFontEngine(true, false, false, true);\r
+-#else\r
+- m_fontEngine = new SplashFontEngine(globalParams->getEnableFreeType(), false, false, true);\r
+-#endif\r
+ }\r
+ \r
+ void SlaOutputDev::startPage(int pageNum, GfxState *, XRef *)\r
+diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
+index 02e5382534..601e287451 100644
+--- a/scribus/plugins/import/pdf/slaoutput.h
++++ b/scribus/plugins/import/pdf/slaoutput.h
+@@ -30,9 +30,6 @@ for which a new license (GPL+exception) is in place.
+ #include "selection.h"\r
+ #include "vgradient.h"\r
+ \r
+-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 73, 0)\r
+-#include <poppler/goo/gtypes.h>\r
+-#endif\r
+ #include <poppler/Object.h>\r
+ #include <poppler/OutputDev.h>\r
+ #include <poppler/Gfx.h>\r
+@@ -163,11 +160,7 @@ class SlaOutputDev : public OutputDev
+ virtual ~SlaOutputDev();\r
+ \r
+ LinkAction* SC_getAction(AnnotWidget *ano);\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
+ std::unique_ptr<LinkAction> SC_getAdditionalAction(const char *key, AnnotWidget *ano);\r
+-#else\r
+- LinkAction* SC_getAdditionalAction(const char *key, AnnotWidget *ano);\r
+-#endif\r
+ static GBool annotations_callback(Annot *annota, void *user_data);\r
+ bool handleTextAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);\r
+ bool handleLinkAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);\r
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+index e20a81f99e..5626fe3477 100644
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s)
+ int shade = 100;\r
+ currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);\r
+ fontSize = state->getFontSize();\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ if (state->getFont() && state->getFont()->getName())\r
++ fontName = new GooString(state->getFont()->getName().value());\r
++#else\r
+ if (state->getFont())\r
+ fontName = state->getFont()->getName()->copy();\r
++#endif\r
+ itemText = s->copy();\r
+ }\r
+ \r
+@@ -357,7 +362,12 @@ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key
+ GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)\r
+ {\r
+ SlaOutputDev *dev = (SlaOutputDev*)user_data;\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ const PDFRectangle& annotRect = annota->getRect();;\r
++ const PDFRectangle* box = &annotRect;\r
++#else\r
+ PDFRectangle *box = annota->getRect();\r
++#endif\r
+ double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX;\r
+ double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;\r
+ double width = box->x2 - box->x1;\r
+@@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
+ if (apa || !achar)\r
+ {\r
+ AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ const PDFRectangle& annotaRect = annota->getRect();\r
++ Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);\r
++#else\r
+ Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);\r
++#endif\r
+ ano->draw(gfx, false);\r
+ if (!bgFound)\r
+ m_currColorFill = annotOutDev->currColorFill;\r
+@@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
+ \r
+ void SlaOutputDev::updateFont(GfxState *state)\r
+ {\r
+- GfxFont *gfxFont;\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ std::optional<GfxFontLoc> fontLoc;\r
++ std::string fileName;\r
++ std::unique_ptr<FoFiTrueType> ff;\r
++ std::optional<std::vector<unsigned char>> tmpBuf;\r
++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
+ std::optional<GfxFontLoc> fontLoc;\r
+ const GooString * fileName = nullptr;\r
+ std::unique_ptr<FoFiTrueType> ff;\r
++ char* tmpBuf = nullptr;\r
+ #else\r
+ GfxFontLoc * fontLoc = nullptr;\r
+ GooString * fileName = nullptr;\r
+ FoFiTrueType * ff = nullptr;\r
++ char* tmpBuf = nullptr;\r
+ #endif\r
+ GfxFontType fontType;\r
+ SlaOutFontFileID *id;\r
+ SplashFontFile *fontFile;\r
+ SplashFontSrc *fontsrc = nullptr;\r
+ Object refObj, strObj;\r
+- char *tmpBuf = nullptr;\r
+ int tmpBufLen = 0;\r
+ int *codeToGID = nullptr;\r
+ const double *textMat = nullptr;\r
+@@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state)
+ \r
+ m_font = nullptr;\r
+ \r
+- gfxFont = state->getFont();\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ GfxFont* gfxFont = state->getFont().get();\r
++#else\r
++ GfxFont* gfxFont = state->getFont();\r
++#endif\r
+ if (!gfxFont)\r
+ goto err1;\r
+ \r
+@@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state)
+ if (fontLoc->locType == gfxFontLocEmbedded)\r
+ {\r
+ // if there is an embedded font, read it to memory\r
+- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef());\r
+ if (! tmpBuf)\r
+ goto err2;\r
++#else\r
++ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);\r
++ if (!tmpBuf)\r
++ goto err2;\r
++#endif\r
+ \r
+ // external font\r
+ }\r
+ else\r
+ { // gfxFontLocExternal\r
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ fileName = fontLoc->path;\r
++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
+ fileName = fontLoc->pathAsGooString();\r
+ #else\r
+ fileName = fontLoc->path;\r
+@@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state)
+ }\r
+ \r
+ fontsrc = new SplashFontSrc;\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ if (!fileName.empty())\r
++ fontsrc->setFile(fileName);\r
++ else\r
++ fontsrc->setBuf(std::move(tmpBuf.value()));\r
++#else\r
+ if (fileName)\r
+ fontsrc->setFile(fileName, gFalse);\r
+ else\r
+ fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);\r
++#endif\r
+ \r
+ // load the font file\r
+ switch (fontType) {\r
+ case fontType1:\r
+- if (!(fontFile = m_fontEngine->loadType1Font(\r
+- id,\r
+- fontsrc,\r
+- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r
++ if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ break;\r
+ case fontType1C:\r
+- if (!(fontFile = m_fontEngine->loadType1CFont(\r
+- id,\r
+- fontsrc,\r
+- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r
++ if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ break;\r
+ case fontType1COT:\r
+- if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(\r
+- id,\r
+- fontsrc,\r
+- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r
++ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ break;\r
+ case fontTrueType:\r
+ case fontTrueTypeOT:\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ if (!fileName.empty())\r
++ ff = FoFiTrueType::load(fileName.c_str());\r
++ else\r
++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());\r
++#else\r
+ if (fileName)\r
+ ff = FoFiTrueType::load(fileName->getCString());\r
+ else\r
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r
++#endif\r
+ if (ff)\r
+ {\r
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
+@@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state)
+ codeToGID = nullptr;\r
+ n = 0;\r
+ }\r
+- if (!(fontFile = m_fontEngine->loadTrueTypeFont(\r
+- id,\r
+- fontsrc,\r
+- codeToGID, n)))\r
++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n)))\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ break;\r
+ case fontCIDType0:\r
+ case fontCIDType0C:\r
+- if (!(fontFile = m_fontEngine->loadCIDFont(\r
+- id,\r
+- fontsrc)))\r
++ if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ break;\r
+@@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state)
+ codeToGID = nullptr;\r
+ n = 0;\r
+ }\r
+- if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(\r
+- id,\r
+- fontsrc,\r
+- codeToGID, n)))\r
++ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n)))\r
+ {\r
+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+ gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+@@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state)
+ }\r
+ else\r
+ {\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
++ if (!fileName.empty())\r
++ ff = FoFiTrueType::load(fileName.c_str());\r
++ else\r
++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());\r
++#else\r
+ if (fileName)\r
+ ff = FoFiTrueType::load(fileName->getCString());\r
+ else\r
+ ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r
++#endif\r
+ if (! ff)\r
+ goto err2;\r
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r
+@@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state)
+ delete ff;\r
+ #endif\r
+ }\r
+- if (!(fontFile = m_fontEngine->loadTrueTypeFont(\r
+- id,\r
+- fontsrc,\r
+- codeToGID, n, faceIndex)))\r
++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex)))\r
+ {\r
+- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r
+- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r
+ goto err2;\r
+ }\r
+ break;\r
+@@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub
+ GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen)\r
+ {\r
+ // qDebug() << "beginType3Char";\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r
+ GfxFont *gfxFont;\r
++ if (!(gfxFont = state->getFont().get()))\r
++ return gTrue;\r
++#else\r
++ GfxFont* gfxFont;\r
+ if (!(gfxFont = state->getFont()))\r
+ return gTrue;\r
++#endif\r
+ if (gfxFont->getType() != fontType3)\r
+ return gTrue;\r
+ F3Entry f3e;\r