gnu: scribus: Fix build against poppler-0.86.
authorBoris A. Dekshteyn <boris.dekshteyn@gmail.com>
Sun, 10 May 2020 15:35:55 +0000 (03:35 +1200)
committerMarius Bakke <mbakke@fastmail.com>
Sun, 10 May 2020 20:59:29 +0000 (22:59 +0200)
* gnu/packages/scribus.scm (scribus)[source](patches): New field.
* gnu/packages/patches/scribus-1.5.5-poppler-0.86-build-fix.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add new patch.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
gnu/local.mk
gnu/packages/patches/scribus-1.5.5-poppler-0.86-build-fix.patch [new file with mode: 0644]
gnu/packages/scribus.scm

index bc34cd0..e73f1c7 100644 (file)
@@ -1480,6 +1480,7 @@ dist_patch_DATA =                                         \
   %D%/packages/patches/scotch-build-parallelism.patch          \
   %D%/packages/patches/scotch-integer-declarations.patch       \
   %D%/packages/patches/screen-hurd-path-max.patch              \
+  %D%/packages/patches/scribus-1.5.5-poppler-0.86-build-fix.patch      \
   %D%/packages/patches/sdl-libx11-1.6.patch                    \
   %D%/packages/patches/seq24-rename-mutex.patch                        \
   %D%/packages/patches/sharutils-CVE-2018-1000097.patch                \
diff --git a/gnu/packages/patches/scribus-1.5.5-poppler-0.86-build-fix.patch b/gnu/packages/patches/scribus-1.5.5-poppler-0.86-build-fix.patch
new file mode 100644 (file)
index 0000000..39008cb
--- /dev/null
@@ -0,0 +1,642 @@
+Fix build with Poppler 0.86.
+
+The original series of patches authored by Craig Bradney <mrb@scribus.info>
+and Jean Ghali <jghali@libertysurf.fr>, taken from
+https://gitweb.gentoo.org/repo/gentoo.git/tree/app-office/scribus/files
+
+diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
+--- a/scribus/plugins/import/pdf/importpdf.cpp
++++ b/scribus/plugins/import/pdf/importpdf.cpp
+@@ -75,7 +75,11 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
+ 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
+       globalParams = new GlobalParams();\r
++#endif\r
+       if (globalParams)\r
+       {\r
+ #if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r
+@@ -90,7 +94,9 @@ QImage PdfPlug::readThumbnail(const QString& fName)
+                       if (pdfDoc->getErrorCode() == errEncrypted)\r
+                       {\r
+                               delete pdfDoc;\r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r
+                               delete globalParams;\r
++#endif\r
+                               return QImage();\r
+                       }\r
+                       if (pdfDoc->isOk())\r
+@@ -134,11 +140,15 @@ QImage PdfPlug::readThumbnail(const QString& fName)
+                               image.setText("YSize", QString("%1").arg(h));\r
+                               delete dev;\r
+                               delete pdfDoc;\r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r
+                               delete globalParams;\r
++#endif\r
+                               return image;\r
+                       }\r
+                       delete pdfDoc;\r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r
+                       delete globalParams;\r
++#endif\r
+               }\r
+       }\r
+       return QImage();\r
+@@ -387,7 +397,11 @@ 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
+       globalParams = new GlobalParams();\r
++#endif\r
+       GooString *userPW = nullptr;\r
+       if (globalParams)\r
+       {\r
+@@ -429,7 +443,9 @@ bool PdfPlug::convert(const QString& fn)
+                                       if (progressDialog)\r
+                                               progressDialog->close();\r
+                                       delete pdfDoc;\r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r
+                                       delete globalParams;\r
++#endif\r
+                                       return false;\r
+                               }\r
+                               if (progressDialog)\r
+@@ -474,7 +490,9 @@ bool PdfPlug::convert(const QString& fn)
+                                                       progressDialog->close();\r
+                                               delete optImp;\r
+                                               delete pdfDoc;\r
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r
+                                               delete globalParams;\r
++#endif\r
+                                               return false;\r
+                                       }\r
+                                       pageString = optImp->getPagesString();\r
+@@ -838,11 +856,20 @@ 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> linkAction;\r
++                                                                      linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());\r
++#else\r
+                                                                       LinkAction *linkAction = nullptr;\r
+                                                                       linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());\r
++#endif\r
+                                                                       if (linkAction)\r
+                                                                       {\r
+-                                                                              LinkJavaScript *jsa = (LinkJavaScript*)linkAction;\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r
++                                                                              LinkJavaScript *jsa = (LinkJavaScript*) linkAction.get();\r
++#else\r
++                                                                              LinkJavaScript *jsa = (LinkJavaScript*) linkAction;\r
++#endif\r
+                                                                               if (jsa->isOk())\r
+                                                                               {\r
+                                                                                       QString script = UnicodeParsedString(jsa->getScript());\r
+@@ -908,8 +935,12 @@ bool PdfPlug::convert(const QString& fn)
+               }\r
+               delete pdfDoc;\r
+       }\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r
++      globalParams.release();\r
++#else\r
+       delete globalParams;\r
+       globalParams = nullptr;\r
++#endif\r
\r
+ //    qDebug() << "converting finished";\r
+ //    qDebug() << "Imported" << Elements.count() << "Elements";\r
+@@ -1046,3 +1077,43 @@ QString PdfPlug::UnicodeParsedString(POPPLER_CONST GooString *s1)
+       }\r
+       return result;\r
+ }\r
++\r
++QString PdfPlug::UnicodeParsedString(const std::string& s1)\r
++{\r
++      if (s1.length() == 0)\r
++              return QString();\r
++      GBool isUnicode;\r
++      int i;\r
++      Unicode u;\r
++      QString result;\r
++      if ((s1.at(0) & 0xff) == 0xfe && (s1.length() > 1 && (s1.at(1) & 0xff) == 0xff))\r
++      {\r
++              isUnicode = gTrue;\r
++              i = 2;\r
++              result.reserve((s1.length() - 2) / 2);\r
++      }\r
++      else\r
++      {\r
++              isUnicode = gFalse;\r
++              i = 0;\r
++              result.reserve(s1.length());\r
++      }\r
++      while (i < s1.length())\r
++      {\r
++              if (isUnicode)\r
++              {\r
++                      u = ((s1.at(i) & 0xff) << 8) | (s1.at(i+1) & 0xff);\r
++                      i += 2;\r
++              }\r
++              else\r
++              {\r
++                      u = s1.at(i) & 0xff;\r
++                      ++i;\r
++              }\r
++              // #15616: imagemagick may write unicode strings incorrectly in PDF\r
++              if (u == 0)\r
++                      continue;\r
++              result += QChar( u );\r
++      }\r
++      return result;\r
++}\r
+diff --git a/scribus/plugins/import/pdf/importpdf.h b/scribus/plugins/import/pdf/importpdf.h
+--- a/scribus/plugins/import/pdf/importpdf.h
++++ b/scribus/plugins/import/pdf/importpdf.h
+@@ -82,6 +82,7 @@ private:
+       bool convert(const QString& fn);
+       QRectF getCBox(int box, int pgNum);
+       QString UnicodeParsedString(POPPLER_CONST GooString *s1);
++      QString UnicodeParsedString(const std::string& s1);
+       
+       QList<PageItem*> Elements;
+       double baseX, baseY;
+diff --git a/scribus/plugins/import/pdf/importpdfconfig.h b/scribus/plugins/import/pdf/importpdfconfig.h
+--- a/scribus/plugins/import/pdf/importpdfconfig.h
++++ b/scribus/plugins/import/pdf/importpdfconfig.h
+@@ -52,4 +52,16 @@ for which a new license (GPL+exception) is in place.
+ #define POPPLER_REF\r
+ #endif\r
\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 82, 0)\r
++#define POPPLER_CONST_082 const\r
++#else\r
++#define POPPLER_CONST_082\r
++#endif\r
++\r
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r
++#define POPPLER_CONST_083 const\r
++#else\r
++#define POPPLER_CONST_083\r
++#endif\r
++\r
+ #endif\r
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -308,9 +308,15 @@ 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
+@@ -455,7 +461,11 @@ 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
+@@ -499,7 +509,11 @@ 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
+@@ -967,7 +981,11 @@ 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
+@@ -1019,7 +1037,11 @@ 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
+@@ -1088,96 +1110,148 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
+               else\r
+                       qDebug() << "Found unsupported Action of type" << Lact->getKind();\r
+       }\r
+-      LinkAction *Aact = SC_getAdditionalAction("D", ano);\r
++      auto Aact = SC_getAdditionalAction("D", ano);\r
+       if (Aact)\r
+       {\r
+               if (Aact->getKind() == actionJavaScript)\r
+               {\r
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+@@ -1185,14 +1259,22 @@ 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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+@@ -1200,21 +1282,33 @@ 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
+-                      LinkJavaScript *jsa = (LinkJavaScript*)Aact;\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
+@@ -1224,6 +1318,11 @@ 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, true, true, true);\r
++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 61, 0)\r
++      m_fontEngine = new SplashFontEngine(globalParams->getEnableFreeType(), true, true, true);\r
++#else\r
+       m_fontEngine = new SplashFontEngine(\r
+ #if HAVE_T1LIB_H\r
+       globalParams->getEnableT1lib(),\r
+@@ -1234,6 +1333,7 @@ void SlaOutputDev::startDoc(PDFDoc *doc, XRef *xrefA, Catalog *catA)
+       true,\r
+ #endif\r
+       true);\r
++#endif\r
+ }\r
\r
+ void SlaOutputDev::startPage(int pageNum, GfxState *, XRef *)\r
+@@ -2784,7 +2884,7 @@ void SlaOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str,  i
+       delete[] mbuffer;\r
+ }\r
\r
+-void SlaOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, int *maskColors, GBool inlineImg)\r
++void SlaOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, POPPLER_CONST_082 int* maskColors, GBool inlineImg)\r
+ {\r
+       ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());\r
+ //    qDebug() << "Image Components" << colorMap->getNumPixelComps() << "Mask" << maskColors;\r
+@@ -3365,7 +3465,7 @@ err1:
+               fontsrc->unref();\r
+ }\r
\r
+-void SlaOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen)\r
++void SlaOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, POPPLER_CONST_082 Unicode *u, int uLen)\r
+ {\r
+       double x1, y1, x2, y2;\r
+       int render;\r
+@@ -3452,7 +3552,7 @@ void SlaOutputDev::drawChar(GfxState *state, double x, double y, double dx, doub
+       }\r
+ }\r
\r
+-GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen)\r
++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
+       GfxFont *gfxFont;\r
+@@ -3705,7 +3805,7 @@ QString SlaOutputDev::getAnnotationColor(const AnnotColor *color)
+       return fNam;\r
+ }\r
\r
+-QString SlaOutputDev::convertPath(GfxPath *path)\r
++QString SlaOutputDev::convertPath(POPPLER_CONST_083 GfxPath *path)\r
+ {\r
+       if (! path)\r
+               return QString();\r
+@@ -3715,7 +3815,7 @@ QString SlaOutputDev::convertPath(GfxPath *path)
\r
+       for (int i = 0; i < path->getNumSubpaths(); ++i)\r
+       {\r
+-              GfxSubpath * subpath = path->getSubpath(i);\r
++              POPPLER_CONST_083 GfxSubpath * subpath = path->getSubpath(i);\r
+               if (subpath->getNumPoints() > 0)\r
+               {\r
+                       output += QString("M %1 %2").arg(subpath->getX(0)).arg(subpath->getY(0));\r
+@@ -3922,6 +4022,46 @@ QString SlaOutputDev::UnicodeParsedString(POPPLER_CONST GooString *s1)
+       return result;\r
+ }\r
\r
++QString SlaOutputDev::UnicodeParsedString(const std::string& s1)\r
++{\r
++      if (s1.length() == 0)\r
++              return QString();\r
++      GBool isUnicode;\r
++      int i;\r
++      Unicode u;\r
++      QString result;\r
++      if ((s1.at(0) & 0xff) == 0xfe && (s1.length() > 1 && (s1.at(1) & 0xff) == 0xff))\r
++      {\r
++              isUnicode = gTrue;\r
++              i = 2;\r
++              result.reserve((s1.length() - 2) / 2);\r
++      }\r
++      else\r
++      {\r
++              isUnicode = gFalse;\r
++              i = 0;\r
++              result.reserve(s1.length());\r
++      }\r
++      while (i < s1.length())\r
++      {\r
++              if (isUnicode)\r
++              {\r
++                      u = ((s1.at(i) & 0xff) << 8) | (s1.at(i+1) & 0xff);\r
++                      i += 2;\r
++              }\r
++              else\r
++              {\r
++                      u = s1.at(i) & 0xff;\r
++                      ++i;\r
++              }\r
++              // #15616: imagemagick may write unicode strings incorrectly in PDF\r
++              if (u == 0)\r
++                      continue;\r
++              result += QChar( u );\r
++      }\r
++      return result;\r
++}\r
++\r
+ bool SlaOutputDev::checkClip()\r
+ {\r
+       bool ret = false;\r
+diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
+--- a/scribus/plugins/import/pdf/slaoutput.h
++++ b/scribus/plugins/import/pdf/slaoutput.h
+@@ -20,6 +20,8 @@ for which a new license (GPL+exception) is in place.
+ #include <QTextStream>\r
+ #include <QTransform>\r
\r
++#include <memory>\r
++\r
+ #include "fpointarray.h"\r
+ #include "importpdfconfig.h"\r
+ #include "pageitem.h"\r
+@@ -159,7 +161,11 @@ public:
+       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
+@@ -229,7 +235,7 @@ public:
\r
+       //----- image drawing\r
+       void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool interpolate, GBool inlineImg) override;\r
+-      void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, int *maskColors, GBool inlineImg) override;\r
++      void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, POPPLER_CONST_082 int *maskColors, GBool inlineImg) override;\r
+       void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,\r
+                                  int width, int height,\r
+                                  GfxImageColorMap *colorMap,\r
+@@ -261,8 +267,8 @@ public:
+       //----- text drawing\r
+       void  beginTextObject(GfxState *state) override;\r
+       void  endTextObject(GfxState *state) override;\r
+-      void  drawChar(GfxState *state, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/) override;\r
+-      GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, CharCode /*code*/, Unicode * /*u*/, int /*uLen*/) override;\r
++      void  drawChar(GfxState *state, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, POPPLER_CONST_082 Unicode * /*u*/, int /*uLen*/) override;\r
++      GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, CharCode /*code*/, POPPLER_CONST_082 Unicode * /*u*/, int /*uLen*/) override;\r
+       void  endType3Char(GfxState * /*state*/) override;\r
+       void  type3D0(GfxState * /*state*/, double /*wx*/, double /*wy*/) override;\r
+       void  type3D1(GfxState * /*state*/, double /*wx*/, double /*wy*/, double /*llx*/, double /*lly*/, double /*urx*/, double /*ury*/) override;\r
+@@ -282,11 +288,12 @@ private:
+       void getPenState(GfxState *state);\r
+       QString getColor(GfxColorSpace *color_space, POPPLER_CONST_070 GfxColor *color, int *shade);\r
+       QString getAnnotationColor(const AnnotColor *color);\r
+-      QString convertPath(GfxPath *path);\r
++      QString convertPath(POPPLER_CONST_083 GfxPath *path);\r
+       int getBlendMode(GfxState *state);\r
+       void applyMask(PageItem *ite);\r
+       void pushGroup(const QString& maskName = "", GBool forSoftMask = gFalse, GBool alpha = gFalse, bool inverted = false);\r
+       QString UnicodeParsedString(POPPLER_CONST GooString *s1);\r
++      QString UnicodeParsedString(const std::string& s1);\r
+       bool checkClip();\r
+       bool pathIsClosed;\r
+       QString CurrColorFill;\r
index 385017f..6519ce7 100644 (file)
@@ -54,6 +54,7 @@
        (method url-fetch)
        (uri (string-append "mirror://sourceforge/scribus/scribus-devel/"
                            version "/scribus-" version ".tar.xz"))
+       (patches (search-patches "scribus-1.5.5-poppler-0.86-build-fix.patch"))
        (sha256
         (base32
          "0w9zzsiaq3f7vpxybk01c9z2b4qqg67mzpyfb2gjchz8dhdb423r"))))