1 From 85c0dff3422fa3c26fbc2e8d8561f597ec24bd92 Mon Sep 17 00:00:00 2001
2 From: Jean Ghali <jghali@libertysurf.fr>
3 Date: Wed, 2 Feb 2022 23:12:52 +0000
4 Subject: [PATCH] #16734: Build break with poppler 22.2.0
6 git-svn-id: svn://scribus.net/trunk/Scribus@24884 11d20701-8431-0410-a711-e3c959e3b870
8 scribus/plugins/import/pdf/slaoutput.cpp | 47 +++++++++++++++++++-----
9 1 file changed, 37 insertions(+), 10 deletions(-)
11 diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
12 index 5894bf2ad6..3650c96f52 100644
13 --- a/scribus/plugins/import/pdf/slaoutput.cpp
14 +++ b/scribus/plugins/import/pdf/slaoutput.cpp
15 @@ -7,6 +7,11 @@ for which a new license (GPL+exception) is in place.
17 #include "slaoutput.h"
\r
19 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
21 +#include <optional>
\r
24 #include <poppler/GlobalParams.h>
\r
25 #include <poppler/poppler-config.h>
\r
26 #include <poppler/FileSpec.h>
\r
27 @@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
28 void SlaOutputDev::updateFont(GfxState *state)
\r
31 - GfxFontLoc *fontLoc;
\r
32 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
33 + std::optional<GfxFontLoc> fontLoc;
\r
34 + const GooString * fileName = nullptr;
\r
35 + std::unique_ptr<FoFiTrueType> ff;
\r
37 + GfxFontLoc * fontLoc = nullptr;
\r
38 + GooString * fileName = nullptr;
\r
39 + FoFiTrueType * ff = nullptr;
\r
41 GfxFontType fontType;
\r
42 SlaOutFontFileID *id;
\r
43 SplashFontFile *fontFile;
\r
44 SplashFontSrc *fontsrc = nullptr;
\r
46 Object refObj, strObj;
\r
47 - GooString *fileName;
\r
49 + char *tmpBuf = nullptr;
\r
52 - const double *textMat;
\r
53 + int *codeToGID = nullptr;
\r
54 + const double *textMat = nullptr;
\r
55 double m11, m12, m21, m22, fontSize;
\r
58 @@ -3046,9 +3057,6 @@ void SlaOutputDev::updateFont(GfxState *state)
59 SplashCoord matrix[6];
\r
62 - fileName = nullptr;
\r
64 - fontLoc = nullptr;
\r
66 gfxFont = state->getFont();
\r
68 @@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state)
71 { // gfxFontLocExternal
\r
72 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
73 + fileName = fontLoc->pathAsGooString();
\r
75 fileName = fontLoc->path;
\r
77 fontType = fontLoc->fontType;
\r
80 @@ -3136,9 +3148,14 @@ void SlaOutputDev::updateFont(GfxState *state)
81 ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
\r
84 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
85 + codeToGID = ((Gfx8BitFont*) gfxFont)->getCodeToGIDMap(ff.get());
\r
88 codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
\r
96 @@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state)
97 ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
\r
100 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
101 + codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);
\r
104 codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
\r
108 if (!(fontFile = m_fontEngine->loadTrueTypeFont(
\r
110 @@ -3247,14 +3269,19 @@ void SlaOutputDev::updateFont(GfxState *state)
112 m_font = m_fontEngine->getFont(fontFile, mat, matrix);
\r
114 +#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
\r
117 if (fontsrc && !fontsrc->isFile)
\r
123 +#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
\r
128 if (fontsrc && !fontsrc->isFile)
\r
130 From f75c1613db67f4067643d0218a2db3235e42ec9f Mon Sep 17 00:00:00 2001
131 From: Jean Ghali <jghali@libertysurf.fr>
132 Date: Thu, 3 Feb 2022 19:46:13 +0000
133 Subject: [PATCH] Small update vs latest code in poppler
135 git-svn-id: svn://scribus.net/trunk/Scribus@24885 11d20701-8431-0410-a711-e3c959e3b870
137 scribus/plugins/import/pdf/slaoutput.cpp | 6 +++---
138 1 file changed, 3 insertions(+), 3 deletions(-)
140 diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
141 index 3650c96f52..a6f4e00fa9 100644
142 --- a/scribus/plugins/import/pdf/slaoutput.cpp
143 +++ b/scribus/plugins/import/pdf/slaoutput.cpp
144 @@ -3072,10 +3072,10 @@ void SlaOutputDev::updateFont(GfxState *state)
148 - if (!(fontLoc = gfxFont->locateFont(xref, nullptr)))
\r
149 + fontLoc = gfxFont->locateFont((xref) ? xref : pdfDoc->getXRef(), nullptr);
\r
152 - error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
\r
153 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
154 + error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
158 From f19410ac3b27e33dd62105746784e61e85b90a1d Mon Sep 17 00:00:00 2001
159 From: Jean Ghali <jghali@libertysurf.fr>
160 Date: Wed, 2 Mar 2022 22:22:53 +0000
161 Subject: [PATCH] #16764: Build break with poppler 22.03.0
163 git-svn-id: svn://scribus.net/trunk/Scribus@24982 11d20701-8431-0410-a711-e3c959e3b870
165 scribus/plugins/import/pdf/importpdf.cpp | 13 +++++++++++++
166 1 file changed, 13 insertions(+)
168 diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
169 index 154e58a3f0..392dcd9e64 100644
170 --- a/scribus/plugins/import/pdf/importpdf.cpp
171 +++ b/scribus/plugins/import/pdf/importpdf.cpp
172 @@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName)
174 globalParams->setErrQuiet(gTrue);
\r
176 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
\r
177 + PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
\r
179 PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};
\r
181 if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)
\r
184 @@ -342,7 +346,11 @@ bool PdfPlug::convert(const QString& fn)
185 globalParams->setErrQuiet(gTrue);
\r
186 // globalParams->setPrintCommands(gTrue);
\r
187 QList<OptionalContentGroup*> ocgGroups;
\r
188 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
\r
189 + auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
\r
191 auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr, nullptr, nullptr));
\r
195 if (pdfDoc->getErrorCode() == errEncrypted)
\r
196 @@ -361,8 +369,13 @@ bool PdfPlug::convert(const QString& fn)
198 auto fname = new GooString(QFile::encodeName(fn).data());
\r
200 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
\r
201 + std::optional<GooString> userPW(std::in_place, text.toLocal8Bit().data());
\r
202 + pdfDoc.reset(new PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));
\r
204 auto userPW = new GooString(text.toLocal8Bit().data());
\r
205 pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr));
\r
207 qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
\r
209 if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone))
\r
210 From f2237b8f0b5cf7690e864a22ef7a63a6d769fa36 Mon Sep 17 00:00:00 2001
211 From: Jean Ghali <jghali@libertysurf.fr>
212 Date: Fri, 1 Apr 2022 23:52:32 +0000
213 Subject: [PATCH] Fix build with poppler 22.04.0
215 git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870
217 scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++---------
218 1 file changed, 78 insertions(+), 45 deletions(-)
220 From e013e8126d2100e8e56dea5b836ad43275429389 Mon Sep 17 00:00:00 2001
221 From: Jean Ghali <jghali@libertysurf.fr>
222 Date: Wed, 2 Mar 2022 22:48:29 +0000
223 Subject: [PATCH] Enforce poppler version >= 0.86.0
225 git-svn-id: svn://scribus.net/trunk/Scribus@24985 11d20701-8431-0410-a711-e3c959e3b870
227 cmake/modules/Findpoppler.cmake | 4 +-
228 scribus/plugins/import/pdf/importpdf.cpp | 65 ++-----------
229 scribus/plugins/import/pdf/slaoutput.cpp | 114 -----------------------
230 scribus/plugins/import/pdf/slaoutput.h | 7 --
231 4 files changed, 10 insertions(+), 180 deletions(-)
233 diff --git a/cmake/modules/Findpoppler.cmake b/cmake/modules/Findpoppler.cmake
234 index 56ce613ae9..9cab5532ab 100644
235 --- a/cmake/modules/Findpoppler.cmake
236 +++ b/cmake/modules/Findpoppler.cmake
238 #include(FindPkgConfig)
239 find_package(PkgConfig QUIET)
240 -pkg_search_module(poppler libpoppler>=0.62.0 poppler>=0.62.0)
241 +pkg_search_module(poppler libpoppler>=0.86.0 poppler>=0.86.0)
243 - pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.62.0 poppler-cpp>=0.62.0)
244 + pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.86.0 poppler-cpp>=0.86.0)
247 find_path(poppler_INCLUDE_DIR
248 diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
249 index 392dcd9e64..970a1a37ca 100644
250 --- a/scribus/plugins/import/pdf/importpdf.cpp
251 +++ b/scribus/plugins/import/pdf/importpdf.cpp
252 @@ -74,20 +74,15 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
254 QImage PdfPlug::readThumbnail(const QString& fName)
\r
256 - QString pdfFile = QDir::toNativeSeparators(fName);
\r
257 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
\r
258 globalParams.reset(new GlobalParams());
\r
260 - std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());
\r
261 - globalParams = globalParamsPtr.get();
\r
263 + globalParams->setErrQuiet(gTrue);
\r
265 -#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
\r
266 + QString pdfFile = QDir::toNativeSeparators(fName);
\r
267 +#if defined(Q_OS_WIN32)
\r
268 auto fname = new GooString(pdfFile.toUtf8().data());
\r
270 auto fname = new GooString(QFile::encodeName(pdfFile).data());
\r
272 - globalParams->setErrQuiet(gTrue);
\r
274 #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
\r
275 PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
\r
276 @@ -332,19 +327,15 @@ bool PdfPlug::convert(const QString& fn)
277 qApp->processEvents();
\r
280 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
\r
281 globalParams.reset(new GlobalParams());
\r
283 - std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());
\r
284 - globalParams = globalParamsPtr.get();
\r
286 -#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
\r
287 + globalParams->setErrQuiet(gTrue);
\r
289 +#if defined(Q_OS_WIN32)
\r
290 auto fname = new GooString(fn.toUtf8().data());
\r
292 auto fname = new GooString(QFile::encodeName(fn).data());
\r
294 - globalParams->setErrQuiet(gTrue);
\r
295 -// globalParams->setPrintCommands(gTrue);
\r
297 QList<OptionalContentGroup*> ocgGroups;
\r
298 #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
\r
299 auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
\r
300 @@ -364,7 +355,7 @@ bool PdfPlug::convert(const QString& fn)
301 QString text = QInputDialog::getText(mw, tr("Open PDF-File"), tr("Password"), QLineEdit::Normal, "", &ok);
\r
302 if (ok && !text.isEmpty())
\r
304 -#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
\r
305 +#if defined(Q_OS_WIN32)
\r
306 auto fname = new GooString(fn.toUtf8().data());
\r
308 auto fname = new GooString(QFile::encodeName(fn).data());
\r
309 @@ -382,9 +373,6 @@ bool PdfPlug::convert(const QString& fn)
311 if (m_progressDialog)
\r
312 m_progressDialog->close();
\r
313 -#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)
\r
314 - delete globalParams;
\r
318 if (m_progressDialog)
\r
319 @@ -494,7 +482,6 @@ bool PdfPlug::convert(const QString& fn)
323 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
\r
324 const auto& ocgs = ocg->getOCGs ();
\r
325 for (const auto& ocg : ocgs)
\r
327 @@ -506,25 +493,11 @@ bool PdfPlug::convert(const QString& fn)
328 ocgNames.append(ocgName);
\r
332 - GooList *ocgs = ocg->getOCGs ();
\r
333 - for (int i = 0; i < ocgs->getLength (); ++i)
\r
335 - OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
\r
336 - QString ocgName = UnicodeParsedString(oc->getName());
\r
337 - if (!ocgNames.contains(ocgName))
\r
339 - ocgGroups.prepend(oc);
\r
340 - ocgNames.append(ocgName);
\r
349 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
\r
350 const auto& ocgs = ocg->getOCGs ();
\r
351 for (const auto& ocg : ocgs)
\r
353 @@ -536,19 +509,6 @@ bool PdfPlug::convert(const QString& fn)
354 ocgNames.append(ocgName);
\r
358 - GooList *ocgs = ocg->getOCGs ();
\r
359 - for (int i = 0; i < ocgs->getLength (); ++i)
\r
361 - OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
\r
362 - QString ocgName = UnicodeParsedString(oc->getName());
\r
363 - if (!ocgNames.contains(ocgName))
\r
365 - ocgGroups.prepend(oc);
\r
366 - ocgNames.append(ocgName);
\r
373 @@ -787,13 +747,8 @@ bool PdfPlug::convert(const QString& fn)
374 names = catDict.dictLookup("OpenAction");
\r
375 if (names.isDict())
\r
377 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
378 std::unique_ptr<LinkAction> linkActionUPtr = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
\r
379 LinkAction *linkAction = linkActionUPtr.get();
\r
381 - LinkAction *linkAction = nullptr;
\r
382 - linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
\r
384 if (linkAction && (linkAction->getKind() == actionJavaScript))
\r
386 LinkJavaScript *jsa = (LinkJavaScript*) linkAction;
\r
387 @@ -861,11 +816,7 @@ bool PdfPlug::convert(const QString& fn)
391 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
\r
392 globalParams.reset();
\r
394 - globalParams = nullptr;
\r
397 // qDebug() << "converting finished";
\r
398 // qDebug() << "Imported" << m_elements.count() << "Elements";
\r
399 diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
400 index a6f4e00fa9..b6f2b8c219 100644
401 --- a/scribus/plugins/import/pdf/slaoutput.cpp
402 +++ b/scribus/plugins/import/pdf/slaoutput.cpp
403 @@ -332,15 +332,9 @@ LinkAction* SlaOutputDev::SC_getAction(AnnotWidget *ano)
406 /* Replacement for the crippled Poppler function LinkAction* AnnotWidget::getAdditionalAction(AdditionalActionsType type) */
\r
407 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
408 std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)
\r
410 std::unique_ptr<LinkAction> linkAction;
\r
412 -LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)
\r
414 - LinkAction *linkAction = nullptr;
\r
417 Ref refa = ano->getRef();
\r
419 @@ -467,11 +461,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
420 if (dst->isPageRef())
\r
422 Ref dstr = dst->getPageRef();
\r
423 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
\r
424 pagNum = pdfDoc->findPage(dstr);
\r
426 - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
\r
430 pagNum = dst->getPageNum();
\r
431 @@ -485,11 +475,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
432 POPPLER_CONST GooString *ndst = gto->getNamedDest();
\r
435 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
436 std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
\r
438 - LinkDest *dstn = pdfDoc->findDest(ndst);
\r
442 if (dstn->getKind() == destXYZ)
\r
443 @@ -497,11 +483,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
444 if (dstn->isPageRef())
\r
446 Ref dstr = dstn->getPageRef();
\r
447 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
\r
448 pagNum = pdfDoc->findPage(dstr);
\r
450 - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
\r
454 pagNum = dstn->getPageNum();
\r
455 @@ -533,11 +515,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
456 POPPLER_CONST GooString *ndst = gto->getNamedDest();
\r
459 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
460 std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
\r
462 - LinkDest *dstn = pdfDoc->findDest(ndst);
\r
466 if (dstn->getKind() == destXYZ)
\r
467 @@ -985,11 +963,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
468 if (dst->isPageRef())
\r
470 Ref dstr = dst->getPageRef();
\r
471 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
\r
472 pagNum = pdfDoc->findPage(dstr);
\r
474 - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
\r
478 pagNum = dst->getPageNum();
\r
479 @@ -1005,11 +979,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
480 POPPLER_CONST GooString *ndst = gto->getNamedDest();
\r
483 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
484 std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
\r
486 - LinkDest *dstn = pdfDoc->findDest(ndst);
\r
490 if (dstn->getKind() == destXYZ)
\r
491 @@ -1017,11 +987,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
492 if (dstn->isPageRef())
\r
494 Ref dstr = dstn->getPageRef();
\r
495 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
\r
496 pagNum = pdfDoc->findPage(dstr);
\r
498 - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
\r
502 pagNum = dstn->getPageNum();
\r
503 @@ -1061,11 +1027,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
504 POPPLER_CONST GooString *ndst = gto->getNamedDest();
\r
507 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
508 std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
\r
510 - LinkDest *dstn = pdfDoc->findDest(ndst);
\r
514 if (dstn->getKind() == destXYZ)
\r
515 @@ -1139,143 +1101,91 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
517 if (Aact->getKind() == actionJavaScript)
\r
519 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
520 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
522 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
526 ite->annotation().setD_act(UnicodeParsedString(jsa->getScript()));
\r
527 ite->annotation().setAAact(true);
\r
530 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
536 Aact = SC_getAdditionalAction("E", ano);
\r
539 if (Aact->getKind() == actionJavaScript)
\r
541 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
542 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
544 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
548 ite->annotation().setE_act(UnicodeParsedString(jsa->getScript()));
\r
549 ite->annotation().setAAact(true);
\r
552 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
558 Aact = SC_getAdditionalAction("X", ano);
\r
561 if (Aact->getKind() == actionJavaScript)
\r
563 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
564 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
566 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
570 ite->annotation().setX_act(UnicodeParsedString(jsa->getScript()));
\r
571 ite->annotation().setAAact(true);
\r
574 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
580 Aact = SC_getAdditionalAction("Fo", ano);
\r
583 if (Aact->getKind() == actionJavaScript)
\r
585 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
586 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
588 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
592 ite->annotation().setFo_act(UnicodeParsedString(jsa->getScript()));
\r
593 ite->annotation().setAAact(true);
\r
596 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
602 Aact = SC_getAdditionalAction("Bl", ano);
\r
605 if (Aact->getKind() == actionJavaScript)
\r
607 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
608 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
610 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
614 ite->annotation().setBl_act(UnicodeParsedString(jsa->getScript()));
\r
615 ite->annotation().setAAact(true);
\r
618 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
624 Aact = SC_getAdditionalAction("C", ano);
\r
627 if (Aact->getKind() == actionJavaScript)
\r
629 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
630 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
632 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
636 ite->annotation().setC_act(UnicodeParsedString(jsa->getScript()));
\r
637 ite->annotation().setAAact(true);
\r
640 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
646 Aact = SC_getAdditionalAction("F", ano);
\r
649 if (Aact->getKind() == actionJavaScript)
\r
651 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
652 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
654 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
658 ite->annotation().setF_act(UnicodeParsedString(jsa->getScript()));
\r
659 @@ -1283,22 +1193,14 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
660 ite->annotation().setFormat(5);
\r
663 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
669 Aact = SC_getAdditionalAction("K", ano);
\r
672 if (Aact->getKind() == actionJavaScript)
\r
674 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
675 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
677 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
681 ite->annotation().setK_act(UnicodeParsedString(jsa->getScript()));
\r
682 @@ -1306,33 +1208,21 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
683 ite->annotation().setFormat(5);
\r
686 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
692 Aact = SC_getAdditionalAction("V", ano);
\r
695 if (Aact->getKind() == actionJavaScript)
\r
697 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
698 LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
\r
700 - LinkJavaScript *jsa = (LinkJavaScript*) Aact;
\r
704 ite->annotation().setV_act(UnicodeParsedString(jsa->getScript()));
\r
705 ite->annotation().setAAact(true);
\r
708 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
716 @@ -1342,11 +1232,7 @@ void SlaOutputDev::startDoc(PDFDoc *doc, XRef *xrefA, Catalog *catA)
719 updateGUICounter = 0;
\r
720 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 84, 0)
\r
721 m_fontEngine = new SplashFontEngine(true, false, false, true);
\r
723 - m_fontEngine = new SplashFontEngine(globalParams->getEnableFreeType(), false, false, true);
\r
727 void SlaOutputDev::startPage(int pageNum, GfxState *, XRef *)
\r
728 diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
729 index 02e5382534..601e287451 100644
730 --- a/scribus/plugins/import/pdf/slaoutput.h
731 +++ b/scribus/plugins/import/pdf/slaoutput.h
732 @@ -30,9 +30,6 @@ for which a new license (GPL+exception) is in place.
733 #include "selection.h"
\r
734 #include "vgradient.h"
\r
736 -#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 73, 0)
\r
737 -#include <poppler/goo/gtypes.h>
\r
739 #include <poppler/Object.h>
\r
740 #include <poppler/OutputDev.h>
\r
741 #include <poppler/Gfx.h>
\r
742 @@ -163,11 +160,7 @@ class SlaOutputDev : public OutputDev
743 virtual ~SlaOutputDev();
\r
745 LinkAction* SC_getAction(AnnotWidget *ano);
\r
746 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
\r
747 std::unique_ptr<LinkAction> SC_getAdditionalAction(const char *key, AnnotWidget *ano);
\r
749 - LinkAction* SC_getAdditionalAction(const char *key, AnnotWidget *ano);
\r
751 static GBool annotations_callback(Annot *annota, void *user_data);
\r
752 bool handleTextAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);
\r
753 bool handleLinkAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);
\r
754 diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
755 index e20a81f99e..5626fe3477 100644
756 --- a/scribus/plugins/import/pdf/slaoutput.cpp
757 +++ b/scribus/plugins/import/pdf/slaoutput.cpp
758 @@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s)
760 currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
\r
761 fontSize = state->getFontSize();
\r
762 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
763 + if (state->getFont() && state->getFont()->getName())
\r
764 + fontName = new GooString(state->getFont()->getName().value());
\r
766 if (state->getFont())
\r
767 fontName = state->getFont()->getName()->copy();
\r
769 itemText = s->copy();
\r
772 @@ -357,7 +362,12 @@ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key
773 GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
\r
775 SlaOutputDev *dev = (SlaOutputDev*)user_data;
\r
776 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
777 + const PDFRectangle& annotRect = annota->getRect();;
\r
778 + const PDFRectangle* box = &annotRect;
\r
780 PDFRectangle *box = annota->getRect();
\r
782 double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX;
\r
783 double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;
\r
784 double width = box->x2 - box->x1;
\r
785 @@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
788 AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);
\r
789 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
790 + const PDFRectangle& annotaRect = annota->getRect();
\r
791 + Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);
\r
793 Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);
\r
795 ano->draw(gfx, false);
\r
797 m_currColorFill = annotOutDev->currColorFill;
\r
798 @@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
800 void SlaOutputDev::updateFont(GfxState *state)
\r
802 - GfxFont *gfxFont;
\r
803 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
804 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
805 + std::optional<GfxFontLoc> fontLoc;
\r
806 + std::string fileName;
\r
807 + std::unique_ptr<FoFiTrueType> ff;
\r
808 + std::optional<std::vector<unsigned char>> tmpBuf;
\r
809 +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
810 std::optional<GfxFontLoc> fontLoc;
\r
811 const GooString * fileName = nullptr;
\r
812 std::unique_ptr<FoFiTrueType> ff;
\r
813 + char* tmpBuf = nullptr;
\r
815 GfxFontLoc * fontLoc = nullptr;
\r
816 GooString * fileName = nullptr;
\r
817 FoFiTrueType * ff = nullptr;
\r
818 + char* tmpBuf = nullptr;
\r
820 GfxFontType fontType;
\r
821 SlaOutFontFileID *id;
\r
822 SplashFontFile *fontFile;
\r
823 SplashFontSrc *fontsrc = nullptr;
\r
824 Object refObj, strObj;
\r
825 - char *tmpBuf = nullptr;
\r
827 int *codeToGID = nullptr;
\r
828 const double *textMat = nullptr;
\r
829 @@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state)
833 - gfxFont = state->getFont();
\r
834 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
835 + GfxFont* gfxFont = state->getFont().get();
\r
837 + GfxFont* gfxFont = state->getFont();
\r
842 @@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state)
843 if (fontLoc->locType == gfxFontLocEmbedded)
\r
845 // if there is an embedded font, read it to memory
\r
846 - tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
\r
847 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
848 + tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef());
\r
852 + tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
\r
860 { // gfxFontLocExternal
\r
861 -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
862 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
863 + fileName = fontLoc->path;
\r
864 +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
865 fileName = fontLoc->pathAsGooString();
\r
867 fileName = fontLoc->path;
\r
868 @@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state)
871 fontsrc = new SplashFontSrc;
\r
872 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
873 + if (!fileName.empty())
\r
874 + fontsrc->setFile(fileName);
\r
876 + fontsrc->setBuf(std::move(tmpBuf.value()));
\r
879 fontsrc->setFile(fileName, gFalse);
\r
881 fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
\r
884 // load the font file
\r
885 switch (fontType) {
\r
887 - if (!(fontFile = m_fontEngine->loadType1Font(
\r
890 - (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
\r
891 + if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
\r
893 - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
894 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
895 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
900 - if (!(fontFile = m_fontEngine->loadType1CFont(
\r
903 - (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
\r
904 + if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
\r
906 - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
907 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
908 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
913 - if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(
\r
916 - (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
\r
917 + if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
\r
919 - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
920 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
921 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
926 case fontTrueTypeOT:
\r
927 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
928 + if (!fileName.empty())
\r
929 + ff = FoFiTrueType::load(fileName.c_str());
\r
931 + ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
\r
934 ff = FoFiTrueType::load(fileName->getCString());
\r
936 ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
\r
940 #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
941 @@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state)
942 codeToGID = nullptr;
\r
945 - if (!(fontFile = m_fontEngine->loadTrueTypeFont(
\r
949 + if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n)))
\r
951 - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
952 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
953 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
958 case fontCIDType0C:
\r
959 - if (!(fontFile = m_fontEngine->loadCIDFont(
\r
962 + if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))
\r
964 - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
965 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
966 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
970 @@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state)
971 codeToGID = nullptr;
\r
974 - if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(
\r
978 + if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n)))
\r
980 error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
981 gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
982 @@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state)
986 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
987 + if (!fileName.empty())
\r
988 + ff = FoFiTrueType::load(fileName.c_str());
\r
990 + ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
\r
993 ff = FoFiTrueType::load(fileName->getCString());
\r
995 ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
\r
999 #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
\r
1000 @@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state)
1004 - if (!(fontFile = m_fontEngine->loadTrueTypeFont(
\r
1007 - codeToGID, n, faceIndex)))
\r
1008 + if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex)))
\r
1010 - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
\r
1011 - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
1012 + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
\r
1016 @@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub
1017 GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen)
\r
1019 // qDebug() << "beginType3Char";
\r
1020 +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
\r
1022 + if (!(gfxFont = state->getFont().get()))
\r
1025 + GfxFont* gfxFont;
\r
1026 if (!(gfxFont = state->getFont()))
\r
1029 if (gfxFont->getType() != fontType3)
\r