Package: scribus
Severity: normal
Tags: patch
X-Debbugs-Cc: [email protected]
Dear Maintainer,
Since Poppler 22.06 made its way into experimental, Scribus will need
compatibility changes that are already in upstream to build.
I cherry-picked the relevant changes in the attached patches. However, although
they apply fine with `patch` on the .orig, the patches won't apply with
`debuild`, and I couldn't figure out why. I'm hoping you will spot it faster
than I.
-- System Information:
Debian Release: bookworm/sid
APT prefers kinetic
APT policy: (500, 'kinetic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.15.0-33-generic (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages scribus depends on:
ii ghostscript 9.55.0~dfsg1-0ubuntu5
ii libc6 2.35-0ubuntu3
ii libcairo2 1.16.0-5ubuntu2
ii libcdr-0.1-1 0.1.6-2build3
ii libcups2 2.4.2-1ubuntu1
ii libfontconfig1 2.13.1-4.4ubuntu1
ii libfreehand-0.1-1 0.1.2-3build2
ii libfreetype6 2.12.1+dfsg-2
ii libgcc-s1 12.1.0-2ubuntu1
ii libgraphicsmagick-q16-3 1.4+really1.3.38-1
ii libharfbuzz-icu0 2.7.4-1ubuntu4
ii libharfbuzz0b 2.7.4-1ubuntu4
ii libhunspell-1.7-0 1.7.0-4build1
ii libicu71 71.1-3
ii libjpeg8 8c-2ubuntu10
ii liblcms2-2 2.12~rc1-2build2
ii libmspub-0.1-1 0.1.4-3build4
pn libopenscenegraph161 <none>
ii libopenthreads21 3.6.5+dfsg1-7build3
ii libpagemaker-0.0-0 0.0.4-1build3
ii libpng16-16 1.6.37-5
ii libpodofo0.9.8 0.9.8+dfsg-2
pn libpoppler118 <none>
ii libpython3.10 3.10.5-1
ii libqt5core5a 5.15.4+dfsg-2
ii libqt5gui5 5.15.4+dfsg-2
ii libqt5network5 5.15.4+dfsg-2
ii libqt5opengl5 5.15.4+dfsg-2
ii libqt5printsupport5 5.15.4+dfsg-2
ii libqt5widgets5 5.15.4+dfsg-2
ii libqt5xml5 5.15.4+dfsg-2
ii libqxp-0.0-0 0.0.2-1build5
ii librevenge-0.0-0 0.0.4-6ubuntu7
ii libstdc++6 12.1.0-2ubuntu1
ii libtiff5 4.4.0~rc1-1
ii libvisio-0.1-1 0.1.7-1build6
ii libxml2 2.9.14+dfsg-1
ii libzmf-0.0-0 0.0.2-1build8
pn scribus-data <none>
ii zlib1g 1:1.2.11.dfsg-2ubuntu9
Versions of packages scribus recommends:
ii cups-bsd 2.4.2-1ubuntu1
ii fonts-dejavu 2.37-2build1
ii fonts-liberation 1:1.07.4-11
ii hyphen-en-us [hyphen-hyphenation-patterns] 2.8.8-7build2
pn icc-profiles-free <none>
ii xfonts-scalable 1:1.0.3-1.2ubuntu1
Versions of packages scribus suggests:
pn icc-profiles <none>
pn scribus-doc <none>
pn scribus-template <none>
ii texlive-latex-recommended 2021.20220204-1
Index: scribus-1.5.8+dfsg/scribus/plugins/import/pdf/importpdf.cpp
===================================================================
--- scribus-1.5.8+dfsg.orig/scribus/plugins/import/pdf/importpdf.cpp
+++ scribus-1.5.8+dfsg/scribus/plugins/import/pdf/importpdf.cpp
@@ -90,7 +90,11 @@ QImage PdfPlug::readThumbnail(const QStr
#endif
globalParams->setErrQuiet(gTrue);
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+ PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
+#else
PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};
+#endif
if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)
return QImage();
@@ -343,7 +347,11 @@ bool PdfPlug::convert(const QString& fn)
globalParams->setErrQuiet(gTrue);
// globalParams->setPrintCommands(gTrue);
QList<OptionalContentGroup*> ocgGroups;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+ auto pdfDoc =
std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
+#else
auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr,
nullptr, nullptr));
+#endif
if (pdfDoc)
{
if (pdfDoc->getErrorCode() == errEncrypted)
@@ -362,8 +370,13 @@ bool PdfPlug::convert(const QString& fn)
#else
auto fname = new
GooString(QFile::encodeName(fn).data());
#endif
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+ std::optional<GooString> userPW(std::in_place,
text.toLocal8Bit().data());
+ pdfDoc.reset(new
PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));
+#else
auto userPW = new
GooString(text.toLocal8Bit().data());
pdfDoc.reset(new PDFDoc(fname, userPW, userPW,
nullptr));
+#endif
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
}
if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone))
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;
currColorText = getColor(state->getFillColorSpace(),
state->getFillColor(), &shade);
fontSize = state->getFontSize();
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ if (state->getFont() && state->getFont()->getName())
+ fontName = new GooString(state->getFont()->getName().value());
+#else
if (state->getFont())
fontName = state->getFont()->getName()->copy();
+#endif
itemText = s->copy();
}
@@ -357,7 +362,12 @@ std::unique_ptr<LinkAction>
SlaOutputDev::SC_getAdditionalAction(const char *key
GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
{
SlaOutputDev *dev = (SlaOutputDev*)user_data;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ const PDFRectangle& annotRect = annota->getRect();;
+ const PDFRectangle* box = &annotRect;
+#else
PDFRectangle *box = annota->getRect();
+#endif
double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 -
dev->cropOffsetX;
double yCoor = dev->m_doc->currentPage()->yOffset() +
dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;
double width = box->x2 - box->x1;
@@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double
xCoor, double yCoor,
if (apa || !achar)
{
AnoOutputDev *annotOutDev = new
AnoOutputDev(m_doc, m_importedColors);
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ const PDFRectangle& annotaRect =
annota->getRect();
+ Gfx* gfx = new Gfx(pdfDoc, annotOutDev,
pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);
+#else
Gfx *gfx = new Gfx(pdfDoc, annotOutDev,
pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);
+#endif
ano->draw(gfx, false);
if (!bgFound)
m_currColorFill =
annotOutDev->currColorFill;
@@ -2916,15 +3031,21 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name,
Dict *properties)
void SlaOutputDev::updateFont(GfxState *state)
{
- GfxFont *gfxFont;
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ std::optional<GfxFontLoc> fontLoc;
+ std::string fileName;
+ std::unique_ptr<FoFiTrueType> ff;
+ std::optional<std::vector<unsigned char>> tmpBuf;
+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
std::optional<GfxFontLoc> fontLoc;
const GooString * fileName = nullptr;
std::unique_ptr<FoFiTrueType> ff;
+ char* tmpBuf = nullptr;
#else
GfxFontLoc * fontLoc = nullptr;
GooString * fileName = nullptr;
FoFiTrueType * ff = nullptr;
+ char* tmpBuf = nullptr;
#endif
GfxFontType fontType;
SlaOutFontFileID *id;
@@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state)
m_font = nullptr;
- gfxFont = state->getFont();
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ GfxFont* gfxFont = state->getFont().get();
+#else
+ GfxFont* gfxFont = state->getFont();
+#endif
if (!gfxFont)
goto err1;
@@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state)
if (fontLoc->locType == gfxFontLocEmbedded)
{
// if there is an embedded font, read it to memory
- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ tmpBuf = gfxFont->readEmbFontFile((xref) ? xref :
pdfDoc->getXRef());
if (! tmpBuf)
goto err2;
+#else
+ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
+ if (!tmpBuf)
+ goto err2;
+#endif
// external font
}
else
{ // gfxFontLocExternal
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ fileName = fontLoc->path;
+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
fileName = fontLoc->pathAsGooString();
#else
fileName = fontLoc->path;
@@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state)
}
fontsrc = new SplashFontSrc;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ if (!fileName.empty())
+ fontsrc->setFile(fileName);
+ else
+ fontsrc->setBuf(std::move(tmpBuf.value()));
+#else
if (fileName)
fontsrc->setFile(fileName, gFalse);
else
fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
+#endif
// load the font file
switch (fontType) {
case fontType1:
- if (!(fontFile = m_fontEngine->loadType1Font(
- id,
- fontsrc,
- (const char **)((Gfx8BitFont *)
gfxFont)->getEncoding())))
+ if (!(fontFile = m_fontEngine->loadType1Font(id,
fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
{
- error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
- gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() :
"(unnamed)");
goto err2;
}
break;
case fontType1C:
- if (!(fontFile = m_fontEngine->loadType1CFont(
- id,
- fontsrc,
- (const char
**)((Gfx8BitFont *) gfxFont)->getEncoding())))
+ if (!(fontFile = m_fontEngine->loadType1CFont(id,
fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
{
- error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
- gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() :
"(unnamed)");
goto err2;
}
break;
case fontType1COT:
- if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(
- id,
- fontsrc,
- (const char
**)((Gfx8BitFont *) gfxFont)->getEncoding())))
+ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id,
fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
{
- error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
- gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() :
"(unnamed)");
goto err2;
}
break;
case fontTrueType:
case fontTrueTypeOT:
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ if (!fileName.empty())
+ ff = FoFiTrueType::load(fileName.c_str());
+ else
+ ff = FoFiTrueType::make(fontsrc->buf.data(),
fontsrc->buf.size());
+#else
if (fileName)
ff = FoFiTrueType::load(fileName->getCString());
else
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
+#endif
if (ff)
{
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
@@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state)
codeToGID = nullptr;
n = 0;
}
- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
- id,
- fontsrc,
- codeToGID, n)))
+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id,
fontsrc, codeToGID, n)))
{
- error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
- gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() :
"(unnamed)");
goto err2;
}
break;
case fontCIDType0:
case fontCIDType0C:
- if (!(fontFile = m_fontEngine->loadCIDFont(
- id,
- fontsrc)))
+ if (!(fontFile = m_fontEngine->loadCIDFont(id,
fontsrc)))
{
- error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
- gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() :
"(unnamed)");
goto err2;
}
break;
@@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state)
codeToGID = nullptr;
n = 0;
}
- if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(
- id,
- fontsrc,
- codeToGID, n)))
+ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id,
fontsrc, codeToGID, n)))
{
error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
@@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state)
}
else
{
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ if (!fileName.empty())
+ ff =
FoFiTrueType::load(fileName.c_str());
+ else
+ ff =
FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
+#else
if (fileName)
ff =
FoFiTrueType::load(fileName->getCString());
else
ff = FoFiTrueType::make(tmpBuf,
tmpBufLen);
+#endif
if (! ff)
goto err2;
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
@@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state)
delete ff;
#endif
}
- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
- id,
- fontsrc,
- codeToGID, n,
faceIndex)))
+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id,
fontsrc, codeToGID, n, faceIndex)))
{
- error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'",
- gfxFont->getName() ?
gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't create a
font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() :
"(unnamed)");
goto err2;
}
break;
@@ -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)
{
// qDebug() << "beginType3Char";
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
GfxFont *gfxFont;
+ if (!(gfxFont = state->getFont().get()))
+ return gTrue;
+#else
+ GfxFont* gfxFont;
if (!(gfxFont = state->getFont()))
return gTrue;
+#endif
if (gfxFont->getType() != fontType3)
return gTrue;
F3Entry f3e;
Index: scribus-1.5.8+dfsg/cmake/modules/Findpoppler.cmake
===================================================================
--- scribus-1.5.8+dfsg.orig/cmake/modules/Findpoppler.cmake
+++ scribus-1.5.8+dfsg/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
Index: scribus-1.5.8+dfsg/scribus/plugins/import/pdf/importpdf.cpp
===================================================================
--- scribus-1.5.8+dfsg.orig/scribus/plugins/import/pdf/importpdf.cpp
+++ scribus-1.5.8+dfsg/scribus/plugins/import/pdf/importpdf.cpp
@@ -75,20 +75,15 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int fl
QImage PdfPlug::readThumbnail(const QString& fName)
{
- QString pdfFile = QDir::toNativeSeparators(fName);
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
globalParams.reset(new GlobalParams());
-#else
- std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());
- globalParams = globalParamsPtr.get();
-#endif
+ globalParams->setErrQuiet(gTrue);
-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >=
POPPLER_VERSION_ENCODE(0, 62, 0)
+ QString pdfFile = QDir::toNativeSeparators(fName);
+#if defined(Q_OS_WIN32)
auto fname = new GooString(pdfFile.toUtf8().data());
#else
auto fname = new GooString(QFile::encodeName(pdfFile).data());
#endif
- globalParams->setErrQuiet(gTrue);
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
@@ -333,19 +328,15 @@ bool PdfPlug::convert(const QString& fn)
qApp->processEvents();
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
globalParams.reset(new GlobalParams());
-#else
- std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());
- globalParams = globalParamsPtr.get();
-#endif
-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >=
POPPLER_VERSION_ENCODE(0, 62, 0)
+ globalParams->setErrQuiet(gTrue);
+
+#if defined(Q_OS_WIN32)
auto fname = new GooString(fn.toUtf8().data());
#else
auto fname = new GooString(QFile::encodeName(fn).data());
#endif
- globalParams->setErrQuiet(gTrue);
-// globalParams->setPrintCommands(gTrue);
+
QList<OptionalContentGroup*> ocgGroups;
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
auto pdfDoc =
std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
@@ -365,7 +356,7 @@ bool PdfPlug::convert(const QString& fn)
QString text = QInputDialog::getText(mw, tr("Open
PDF-File"), tr("Password"), QLineEdit::Normal, "", &ok);
if (ok && !text.isEmpty())
{
-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >=
POPPLER_VERSION_ENCODE(0, 62, 0)
+#if defined(Q_OS_WIN32)
auto fname = new GooString(fn.toUtf8().data());
#else
auto fname = new
GooString(QFile::encodeName(fn).data());
@@ -383,9 +374,6 @@ bool PdfPlug::convert(const QString& fn)
{
if (m_progressDialog)
m_progressDialog->close();
-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)
- delete globalParams;
-#endif
return false;
}
if (m_progressDialog)
@@ -495,7 +483,6 @@ bool PdfPlug::convert(const QString& fn)
}
else
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
const auto&
ocgs = ocg->getOCGs ();
for (const
auto& ocg : ocgs)
{
@@ -507,25 +494,11 @@ bool PdfPlug::convert(const QString& fn)
ocgNames.append(ocgName);
}
}
-#else
- GooList *ocgs =
ocg->getOCGs ();
- for (int i = 0;
i < ocgs->getLength (); ++i)
- {
-
OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
- QString
ocgName = UnicodeParsedString(oc->getName());
- if
(!ocgNames.contains(ocgName))
- {
-
ocgGroups.prepend(oc);
-
ocgNames.append(ocgName);
- }
- }
-#endif
}
}
}
else
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
const auto& ocgs = ocg->getOCGs
();
for (const auto& ocg : ocgs)
{
@@ -537,19 +510,6 @@ bool PdfPlug::convert(const QString& fn)
ocgNames.append(ocgName);
}
}
-#else
- GooList *ocgs = ocg->getOCGs ();
- for (int i = 0; i <
ocgs->getLength (); ++i)
- {
- OptionalContentGroup
*oc = (OptionalContentGroup *)ocgs->get(i);
- QString ocgName =
UnicodeParsedString(oc->getName());
- if
(!ocgNames.contains(ocgName))
- {
-
ocgGroups.prepend(oc);
-
ocgNames.append(ocgName);
- }
- }
-#endif
}
}
@@ -788,13 +748,8 @@ bool PdfPlug::convert(const QString& fn)
names =
catDict.dictLookup("OpenAction");
if (names.isDict())
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkAction> linkActionUPtr = LinkAction::parseAction(&names,
pdfDoc->getCatalog()->getBaseURI());
LinkAction
*linkAction = linkActionUPtr.get();
-#else
- LinkAction
*linkAction = nullptr;
- linkAction =
LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
-#endif
if (linkAction
&& (linkAction->getKind() == actionJavaScript))
{
LinkJavaScript *jsa = (LinkJavaScript*) linkAction;
@@ -862,11 +817,7 @@ bool PdfPlug::convert(const QString& fn)
}
pdfDoc.reset();
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
globalParams.reset();
-#else
- globalParams = nullptr;
-#endif
// qDebug() << "converting finished";
// qDebug() << "Imported" << m_elements.count() << "Elements";
Index: scribus-1.5.8+dfsg/scribus/plugins/import/pdf/slaoutput.cpp
===================================================================
--- scribus-1.5.8+dfsg.orig/scribus/plugins/import/pdf/slaoutput.cpp
+++ scribus-1.5.8+dfsg/scribus/plugins/import/pdf/slaoutput.cpp
@@ -332,15 +332,9 @@ LinkAction* SlaOutputDev::SC_getAction(A
}
/* Replacement for the crippled Poppler function LinkAction*
AnnotWidget::getAdditionalAction(AdditionalActionsType type) */
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char
*key, AnnotWidget *ano)
{
std::unique_ptr<LinkAction> linkAction;
-#else
-LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget
*ano)
-{
- LinkAction *linkAction = nullptr;
-#endif
Object obj;
Ref refa = ano->getRef();
@@ -467,11 +461,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot
if (dst->isPageRef())
{
Ref dstr = dst->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
pagNum = pdfDoc->findPage(dstr);
-#else
- pagNum = pdfDoc->findPage(dstr.num,
dstr.gen);
-#endif
}
else
pagNum = dst->getPageNum();
@@ -485,11 +475,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot
POPPLER_CONST GooString *ndst = gto->getNamedDest();
if (ndst)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkDest> dstn =
pdfDoc->findDest(ndst);
-#else
- LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
if (dstn)
{
if (dstn->getKind() == destXYZ)
@@ -497,11 +483,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot
if (dstn->isPageRef())
{
Ref dstr =
dstn->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
pagNum =
pdfDoc->findPage(dstr);
-#else
- pagNum =
pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
}
else
pagNum =
dstn->getPageNum();
@@ -533,11 +515,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot
POPPLER_CONST GooString *ndst = gto->getNamedDest();
if (ndst)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkDest> dstn =
pdfDoc->findDest(ndst);
-#else
- LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
if (dstn)
{
if (dstn->getKind() == destXYZ)
@@ -985,11 +963,7 @@ void SlaOutputDev::handleActions(PageIte
if (dst->isPageRef())
{
Ref dstr = dst->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
pagNum = pdfDoc->findPage(dstr);
-#else
- pagNum =
pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
}
else
pagNum = dst->getPageNum();
@@ -1005,11 +979,7 @@ void SlaOutputDev::handleActions(PageIte
POPPLER_CONST GooString *ndst =
gto->getNamedDest();
if (ndst)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkDest> dstn =
pdfDoc->findDest(ndst);
-#else
- LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
if (dstn)
{
if (dstn->getKind() == destXYZ)
@@ -1017,11 +987,7 @@ void SlaOutputDev::handleActions(PageIte
if (dstn->isPageRef())
{
Ref dstr =
dstn->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
pagNum =
pdfDoc->findPage(dstr);
-#else
- pagNum =
pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
}
else
pagNum =
dstn->getPageNum();
@@ -1061,11 +1027,7 @@ void SlaOutputDev::handleActions(PageIte
POPPLER_CONST GooString *ndst =
gto->getNamedDest();
if (ndst)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkDest> dstn =
pdfDoc->findDest(ndst);
-#else
- LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
if (dstn)
{
if (dstn->getKind() == destXYZ)
@@ -1139,143 +1101,91 @@ void SlaOutputDev::handleActions(PageIte
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setD_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("E", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setE_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("X", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setX_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("Fo", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setFo_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("Bl", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setBl_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("C", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setC_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("F", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setF_act(UnicodeParsedString(jsa->getScript()));
@@ -1283,22 +1193,14 @@ void SlaOutputDev::handleActions(PageIte
ite->annotation().setFormat(5);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("K", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setK_act(UnicodeParsedString(jsa->getScript()));
@@ -1306,33 +1208,21 @@ void SlaOutputDev::handleActions(PageIte
ite->annotation().setFormat(5);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
Aact = SC_getAdditionalAction("V", ano);
if (Aact)
{
if (Aact->getKind() == actionJavaScript)
{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
- LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
if (jsa->isOk())
{
ite->annotation().setV_act(UnicodeParsedString(jsa->getScript()));
ite->annotation().setAAact(true);
}
}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
Aact.reset();
-#else
- Aact = nullptr;
-#endif
}
}
@@ -1342,11 +1232,7 @@ void SlaOutputDev::startDoc(PDFDoc *doc,
catalog = catA;
pdfDoc = doc;
updateGUICounter = 0;
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 84, 0)
m_fontEngine = new SplashFontEngine(true, false, false, true);
-#else
- m_fontEngine = new SplashFontEngine(globalParams->getEnableFreeType(),
false, false, true);
-#endif
}
void SlaOutputDev::startPage(int pageNum, GfxState *, XRef *)
Index: scribus-1.5.8+dfsg/scribus/plugins/import/pdf/slaoutput.h
===================================================================
--- scribus-1.5.8+dfsg.orig/scribus/plugins/import/pdf/slaoutput.h
+++ scribus-1.5.8+dfsg/scribus/plugins/import/pdf/slaoutput.h
@@ -30,9 +30,6 @@ for which a new license (GPL+exception)
#include "selection.h"
#include "vgradient.h"
-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 73, 0)
-#include <poppler/goo/gtypes.h>
-#endif
#include <poppler/Object.h>
#include <poppler/OutputDev.h>
#include <poppler/Gfx.h>
@@ -163,11 +160,7 @@ public:
virtual ~SlaOutputDev();
LinkAction* SC_getAction(AnnotWidget *ano);
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
std::unique_ptr<LinkAction> SC_getAdditionalAction(const char *key,
AnnotWidget *ano);
-#else
- LinkAction* SC_getAdditionalAction(const char *key, AnnotWidget *ano);
-#endif
static GBool annotations_callback(Annot *annota, void *user_data);
bool handleTextAnnot(Annot* annota, double xCoor, double yCoor, double
width, double height);
bool handleLinkAnnot(Annot* annota, double xCoor, double yCoor, double
width, double height);
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.
#include "slaoutput.h"
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+#include <memory>
+#include <optional>
+#endif
+
#include <poppler/GlobalParams.h>
#include <poppler/poppler-config.h>
#include <poppler/FileSpec.h>
@@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name,
Dict *properties)
void SlaOutputDev::updateFont(GfxState *state)
{
GfxFont *gfxFont;
- GfxFontLoc *fontLoc;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ std::optional<GfxFontLoc> fontLoc;
+ const GooString * fileName = nullptr;
+ std::unique_ptr<FoFiTrueType> ff;
+#else
+ GfxFontLoc * fontLoc = nullptr;
+ GooString * fileName = nullptr;
+ FoFiTrueType * ff = nullptr;
+#endif
GfxFontType fontType;
SlaOutFontFileID *id;
SplashFontFile *fontFile;
SplashFontSrc *fontsrc = nullptr;
- FoFiTrueType *ff;
Object refObj, strObj;
- GooString *fileName;
- char *tmpBuf;
+ char *tmpBuf = nullptr;
int tmpBufLen = 0;
- int *codeToGID;
- const double *textMat;
+ int *codeToGID = nullptr;
+ const double *textMat = nullptr;
double m11, m12, m21, m22, fontSize;
SplashCoord mat[4];
int n = 0;
@@ -3046,9 +3057,6 @@ void SlaOutputDev::updateFont(GfxState *state)
SplashCoord matrix[6];
m_font = nullptr;
- fileName = nullptr;
- tmpBuf = nullptr;
- fontLoc = nullptr;
gfxFont = state->getFont();
if (!gfxFont)
@@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state)
}
else
{ // gfxFontLocExternal
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ fileName = fontLoc->pathAsGooString();
+#else
fileName = fontLoc->path;
+#endif
fontType = fontLoc->fontType;
}
@@ -3136,9 +3148,14 @@ void SlaOutputDev::updateFont(GfxState *state)
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (ff)
{
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ codeToGID = ((Gfx8BitFont*)
gfxFont)->getCodeToGIDMap(ff.get());
+ ff.reset();
+#else
codeToGID = ((Gfx8BitFont
*)gfxFont)->getCodeToGIDMap(ff);
- n = 256;
delete ff;
+#endif
+ n = 256;
}
else
{
@@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state)
ff = FoFiTrueType::make(tmpBuf,
tmpBufLen);
if (! ff)
goto err2;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ codeToGID = ((GfxCIDFont*)
gfxFont)->getCodeToGIDMap(ff.get(), &n);
+ ff.reset();
+#else
codeToGID = ((GfxCIDFont
*)gfxFont)->getCodeToGIDMap(ff, &n);
delete ff;
+#endif
}
if (!(fontFile = m_fontEngine->loadTrueTypeFont(
id,
@@ -3247,14 +3269,19 @@ void SlaOutputDev::updateFont(GfxState *state)
mat[3] = -m22;
m_font = m_fontEngine->getFont(fontFile, mat, matrix);
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
delete fontLoc;
+#endif
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
return;
err2:
delete id;
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
delete fontLoc;
+#endif
+
err1:
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();