SHA256
1
0
forked from pool/scribus

Accepting request 1144999 from KDE:Extra

Update to 1.6.1

OBS-URL: https://build.opensuse.org/request/show/1144999
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/scribus?expand=0&rev=84
This commit is contained in:
Ana Guerrero 2024-02-08 18:01:51 +00:00 committed by Git OBS Bridge
commit a46631011a
14 changed files with 216 additions and 1217 deletions

View File

@ -1,132 +0,0 @@
From 699df2330c9bd28a43fa7a5ec25581ca22ddb898 Mon Sep 17 00:00:00 2001
From: jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>
Date: Wed, 2 Feb 2022 23:12:52 +0000
Subject: [PATCH] #16734: Build break with poppler 22.2.0
git-svn-id: svn://scribus.net/trunk/Scribus@24884 11d20701-8431-0410-a711-e3c959e3b870
---
scribus/plugins/import/pdf/slaoutput.cpp | 47 +++++++++++++++++++-----
1 file changed, 37 insertions(+), 10 deletions(-)
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 5894bf2ad..3650c96f5 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();
--
2.35.1

View File

@ -1,101 +0,0 @@
From 20c1757209a9742edd2b1c524acb88ae1c557d73 Mon Sep 17 00:00:00 2001
From: jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>
Date: Thu, 3 Mar 2022 00:18:06 +0000
Subject: [PATCH] #16764: Better patch, avoid a memory leak
git-svn-id: svn://scribus.net/trunk/Scribus@24989 11d20701-8431-0410-a711-e3c959e3b870
---
scribus/plugins/import/pdf/importpdf.cpp | 34 +++++++++---------------
scribus/util_os.cpp | 2 ++
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 970a1a37c..7da93a5b2 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -57,6 +57,7 @@ for which a new license (GPL+exception) is in place.
#include "util.h"
#include "util_formats.h"
#include "util_math.h"
+#include "util_os.h"
#include "ui/customfdialog.h"
#include "ui/missing.h"
@@ -78,15 +79,12 @@ QImage PdfPlug::readThumbnail(const QString& fName)
globalParams->setErrQuiet(gTrue);
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
-
+ QByteArray encodedFileName = os_is_win() ? pdfFile.toUtf8() : QFile::encodeName(pdfFile);
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
- PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
+ auto fname = std::make_unique<GooString>(encodedFileName.data());
+ PDFDoc pdfDoc{ std::move(fname) };
#else
+ auto fname = new GooString(encodedFileName.data());
PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};
#endif
if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)
@@ -330,17 +328,14 @@ bool PdfPlug::convert(const QString& fn)
globalParams.reset(new GlobalParams());
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
-
QList<OptionalContentGroup*> ocgGroups;
+ QByteArray encodedFileName = os_is_win() ? fn.toUtf8() : QFile::encodeName(fn);
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
- auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
+ auto fname = std::make_unique<GooString>(encodedFileName.data());
+ auto pdfDoc = std::make_unique<PDFDoc>(std::move(fname));
#else
- auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr, nullptr, nullptr));
+ auto fname = new GooString(encodedFileName.data());
+ auto pdfDoc = std::make_unique<PDFDoc>(fname, nullptr, nullptr, nullptr);
#endif
if (pdfDoc)
{
@@ -355,15 +350,12 @@ 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)
- auto fname = new GooString(fn.toUtf8().data());
-#else
- auto fname = new GooString(QFile::encodeName(fn).data());
-#endif
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+ auto fname = std::make_unique<GooString>(encodedFileName.data());
std::optional<GooString> userPW(std::in_place, text.toLocal8Bit().data());
- pdfDoc.reset(new PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));
+ pdfDoc.reset(new PDFDoc(std::move(fname), userPW, userPW, nullptr));
#else
+ auto fname = new GooString(encodedFileName.data());
auto userPW = new GooString(text.toLocal8Bit().data());
pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr));
#endif
diff --git a/scribus/util_os.cpp b/scribus/util_os.cpp
index fadf37d59..56e50aec3 100644
--- a/scribus/util_os.cpp
+++ b/scribus/util_os.cpp
@@ -22,6 +22,8 @@ for which a new license (GPL+exception) is in place.
#include <QtGlobal>
+#include "util_os.h"
+
bool os_is_osx()
{
#ifdef Q_OS_MACOS
--
2.35.1

View File

@ -1,55 +0,0 @@
From 6512c88e45ad8406949a238962b9523f9c21e0c3 Mon Sep 17 00:00:00 2001
From: jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>
Date: Wed, 2 Mar 2022 22:22:53 +0000
Subject: [PATCH] #16764: Build break with poppler 22.03.0
git-svn-id: svn://scribus.net/trunk/Scribus@24982 11d20701-8431-0410-a711-e3c959e3b870
---
scribus/plugins/import/pdf/importpdf.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 154e58a3f..392dcd9e6 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName)
#endif
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();
@@ -342,7 +346,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)
@@ -361,8 +369,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))
--
2.35.1

View File

@ -1,537 +0,0 @@
From 5838ad95e3378c0417bbd42d66ab24b63d585c92 Mon Sep 17 00:00:00 2001
From: jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>
Date: Wed, 2 Mar 2022 22:48:29 +0000
Subject: [PATCH] Enforce poppler version >= 0.86.0
git-svn-id: svn://scribus.net/trunk/Scribus@24985 11d20701-8431-0410-a711-e3c959e3b870
---
cmake/modules/Findpoppler.cmake | 4 +-
scribus/plugins/import/pdf/importpdf.cpp | 65 ++-----------
scribus/plugins/import/pdf/slaoutput.cpp | 114 -----------------------
scribus/plugins/import/pdf/slaoutput.h | 7 --
4 files changed, 10 insertions(+), 180 deletions(-)
diff --git a/cmake/modules/Findpoppler.cmake b/cmake/modules/Findpoppler.cmake
index 56ce613ae..9cab5532a 100644
--- a/cmake/modules/Findpoppler.cmake
+++ b/cmake/modules/Findpoppler.cmake
@@ -1,8 +1,8 @@
#include(FindPkgConfig)
find_package(PkgConfig QUIET)
-pkg_search_module(poppler libpoppler>=0.62.0 poppler>=0.62.0)
+pkg_search_module(poppler libpoppler>=0.86.0 poppler>=0.86.0)
if (poppler_FOUND)
- pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.62.0 poppler-cpp>=0.62.0)
+ pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.86.0 poppler-cpp>=0.86.0)
endif(poppler_FOUND)
find_path(poppler_INCLUDE_DIR
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 392dcd9e6..970a1a37c 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -74,20 +74,15 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
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) };
@@ -332,19 +327,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));
@@ -364,7 +355,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());
@@ -382,9 +373,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)
@@ -494,7 +482,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)
{
@@ -506,25 +493,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)
{
@@ -536,19 +509,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
}
}
@@ -787,13 +747,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;
@@ -861,11 +816,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";
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index a6f4e00fa..b6f2b8c21 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -332,15 +332,9 @@ LinkAction* SlaOutputDev::SC_getAction(AnnotWidget *ano)
}
/* 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* annota, double xCoor, double yCoor, do
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* annota, double xCoor, double yCoor, do
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* annota, double xCoor, double yCoor, do
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* annota, double xCoor, double yCoor, do
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(PageItem* ite, AnnotWidget *ano)
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(PageItem* ite, AnnotWidget *ano)
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(PageItem* ite, AnnotWidget *ano)
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(PageItem* ite, AnnotWidget *ano)
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(PageItem* ite, AnnotWidget *ano)
{
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(PageItem* ite, AnnotWidget *ano)
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(PageItem* ite, AnnotWidget *ano)
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, XRef *xrefA, Catalog *catA)
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 *)
diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
index 02e538253..601e28745 100644
--- a/scribus/plugins/import/pdf/slaoutput.h
+++ b/scribus/plugins/import/pdf/slaoutput.h
@@ -30,9 +30,6 @@ for which a new license (GPL+exception) is in place.
#include "selection.h"
#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);
--
2.35.1

View File

@ -1,291 +0,0 @@
From 1e0605f9b40c2fcd3bb73413235341ef4649937f Mon Sep 17 00:00:00 2001
From: jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>
Date: Fri, 1 Apr 2022 23:52:32 +0000
Subject: [PATCH] Fix build with poppler 22.04.0
git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870
---
scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++---------
1 file changed, 78 insertions(+), 45 deletions(-)
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index e20a81f99..5626fe347 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,22 +2931,27 @@ 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;
SplashFontFile *fontFile;
SplashFontSrc *fontsrc = nullptr;
Object refObj, strObj;
- char *tmpBuf = nullptr;
int tmpBufLen = 0;
int *codeToGID = nullptr;
const double *textMat = nullptr;
@@ -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;
--
2.35.3

View File

@ -1,31 +0,0 @@
From 0ac8654a468b077fd1c736f4c6245435efd70d13 Mon Sep 17 00:00:00 2001
From: jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>
Date: Thu, 3 Feb 2022 19:46:13 +0000
Subject: [PATCH] Small update vs latest code in poppler
git-svn-id: svn://scribus.net/trunk/Scribus@24885 11d20701-8431-0410-a711-e3c959e3b870
---
scribus/plugins/import/pdf/slaoutput.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 3650c96f5..a6f4e00fa 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -3072,10 +3072,10 @@ void SlaOutputDev::updateFont(GfxState *state)
delete id;
else
{
- if (!(fontLoc = gfxFont->locateFont(xref, nullptr)))
+ fontLoc = gfxFont->locateFont((xref) ? xref : pdfDoc->getXRef(), nullptr);
+ if (!fontLoc)
{
- error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
--
2.35.1

View File

@ -1,26 +0,0 @@
poppler 22.09 compatibility.
Origin: archlinux
https://github.com/archlinux/svntogit-community/blob/packages/scribus/trunk/scribus-1.5.8-poppler-22.09.0.patch
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 8723b36..0f75cec 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -3627,9 +3627,16 @@ void SlaOutputDev::getPenState(GfxState *state)
break;
}
double lw = state->getLineWidth();
- double *dashPattern;
int dashLength;
- state->getLineDash(&dashPattern, &dashLength, &DashOffset);
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 9, 0)
+ const double *dashPattern;
+ const std::vector<double> &dash = state->getLineDash(&DashOffset);
+ dashPattern = dash.data();
+ dashLength = dash.size();
+#else
+ double *dashPattern;
+ state->getLineDash(&dashPattern, &dashLength, &DashOffset);
+#endif
QVector<double> pattern(dashLength);
for (int i = 0; i < dashLength; ++i)
{

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47816e8fcf6d05788ff16aa4499f97ff22431c777a7789149b0a88b451e16b74
size 74543476

View File

@ -1,6 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRlWL6E0nJzpDihURmL6kgRiuvuZAUCYe2OlQAKCRCL6kgRiuvu
ZEVjAJ9VmCNNM+QgJxEsSdXRYhVvKJYfZwCgqIzpdA5U+kkEP7X1t/TbjIQQWg4=
=eiTm
-----END PGP SIGNATURE-----

3
scribus-1.6.1.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e09dd78e6db61d01b9321108fededbccd6ec0ab352dd5bafdb8b041f0ef79e99
size 73266900

6
scribus-1.6.1.tar.xz.asc Normal file
View File

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRlWL6E0nJzpDihURmL6kgRiuvuZAUCZZrcsAAKCRCL6kgRiuvu
ZMHiAJ9ikkeBnrBwszyqOvt/hxzXW9+GmQCgmK/Q6WTC+8oBDLklmYmF+sIkeb4=
=jSAp
-----END PGP SIGNATURE-----

View File

@ -1,3 +1,187 @@
-------------------------------------------------------------------
Wed Feb 7 17:39:59 UTC 2024 - Christophe Marin <christophe@krop.fr>
- Update to 1.6.1:
* [Scripter] Scripter: add functions to get the items in a group
* [Scripter] Scripter: add the return values for getObjectType
* [Story Editor / Text Frames] Wrapped text appears outside text
frame
* [Typography] Hyphenated text is rendering incorrectly in text
boxes
* [Usability] DublinCore DocInfo ComboBoxes
* [Usability] PDF/X accurate versions
* [OS-Win32] Windows installer causes reboot on some systems
part way through installation
* [User Interface] new document icon in 22x22 is garbage...
* [Language Tools] Can´t paste Spanish content
* [Story Editor / Text Frames] center alignment unprecise in
circles
* [Internal] [patch] remove a specific disabled broken code
or document what it should do
* [Usability] Y coordinate not updated in popup window
* [Build System] [PATCH] clean up the cmake files
* [User Interface] Create a command launcher
* [Story Editor / Text Frames] inline items produce a box at
the start of the frame
* [Story Editor / Text Frames] Incorrect layout of inline
items if vertical scale is different of 100%
* [User Interface] Snapping doesn't work when scaling frames
* [Canvas] Page margin rect inherits drop shadow properties of
line item
* [User Interface] ICC profile comboboxes too short
* [Translation] Wrong polish translation of orphan in edit->styles
* [Graphics / Image Frames] Adding a specific .psd file makes
itself and the other frames invisible
* [Scripter] PATCH: scripter: create setRotation(), deprecate
rotateObjectAbs() and add a way to use a specific basepoint
* [User Interface] arrange pages still has 3 and 4 pages layouts
* [Canvas] Changing the line blend mode has no effect on the canvas
* [User Interface] Add context menu to the "Arrange
Pages > Document Pages" Panel
* [User Interface] Spiral Edit Dialog doesn't allow angle greater
than 360°
* [General] When saving the document, arrows attached to spiral
shapes are not saved
* [Scripter] scribus_version and scribus_version_info should be
uppercase
* [Build System] [Proposal] Display versions of all libs used by
Scribus
* [General] Tooltips show no text
* [User Interface] Drag/Drop of ODT to text frame should trigger
the OpenDocument Importer menu
* [Scrapbook] White objects are invisible in scrapbook
* [Printing] Page prints incorrectly on Windows when using layer
blend modes
* [Styles] Sort the styles list in style deletion dialog
* [Typography] Hyphenation exceptions delete themselves
* [General] crash when starting the "insert > glyph" dialog
* [General] for loop defect
* [Scripter] [PATCH] scripter: accessing page > guides > columns/rows
* [Story Editor / Text Frames] Incorrect rendering of rotated
inline items
* [Story Editor / Text Frames] Copying a frame does not activate
paste when editing inside of a frame
* [Language Tools] File for Dutch hyphenation patterns gives bad
results.
* [General] Crash on startup if file recovery fails
* [Scripter] [PATCH] add setNormalMode() (and setEditMode()) to
the scripter
* [Graphics / Image Frames] Export to PDF ignores coloring effect
on grayscale PNG
* [User Interface] About box: Some names formatted improperly
in Authors tab
* [Build System] Build error caused by removed
'std::unary_function' template in C++17 mode
* [Build System] Build error caused by conversion between void
pointer and function pointer
* [User Interface] About box: table tags not closed
* [User Interface] About box: Some text issues in
Translations tab
* [General] Search & Replace 'Replace All' hangs Scribus when
searching for text color
* [Build System] Build failure on newer macOS versions than
were available when Scribus was released
* [Translation] Translation problems in story editor when
changing language from settings
* [General] Scribus slow and unusable on Wayland
* [User Interface] Document Items Attributes in Document
Setup/Preferences
* [Internal] Rename ui/cpalette.* to ui/colorpalette.*
* [Integration] CI fails because of podofo
* [Story Editor / Text Frames] Bad inline object vertical
alignement in PDF export
* [Build System] CI on Gitlab is failing on podofo
* [General] Scribus does not build with podofo-0.10.0
* [Internal] Internal page links not updated on page copy
* [Usability] Default button for preferences should be "Ok"
* [PDF] Build break with poppler 22.2.0
* [Story Editor / Text Frames] Hyphenation stop being applied
after conditional hyphen
* [Master Pages] Crash when clicking on specific text frame
in master page
* [User Interface] Keyboard shortcuts always load "iCalamusTM"
and modifications cannot be saved.
* [Translation] Norwegian nynorsk invalid file
* [Master Pages] Arrange Pages> Document Pages> mini-pages
are almost unreadable on hi-res display
* [Translation] Spelling error in French translation
* [PDF] Build break with poppler 22.03.0
* [PDF] Dashed lines imported from PDF have incorrect
segment lengths
* [General] Fix various typos
* [Graphics / Image Frames] "Show readable text" Option for
QR Code on "Insert Barcode" Window should be grey out
* [Graphics / Image Frames] QR code generated by "Insert
Barcode" could not show CJK characters correctly
* [Documentation] Fix various typos
* [Graphics / Image Frames] Issue when opening TIFF file
with incorrect embedded ICC profile
* [Scripter] importPage() argument usage documentation
* [Scripter] linkTextFrames() documentation vs GUI
* [User Interface] Scrapbook dialog dropdown menu has
unintuitive icon
* [Scripter] Scripter crashes with getAllObjects() on a
master page
* [Typography] A white space width become too small when
two Latin words are surrounded by CJK characters in a
justified paragraph
* [Scripter] Documentation of selectObject() lacks precision
* [Build System] No Document Icon is installed on Linux
* [Import / Export] Cannot export - save as image when active
layer is locked.
* [General] Import of Adobe Color Book palettes doesn't work
* [Usability] Unremovable or invisible tabulators on the ruler
* [User Interface] Cyrillic in Render Frame Editor English GUI
* [Typography] OpenType c2sc not practically usable
* [General] Scrbus fails to build since code cleanup in r25414
* [Printing] Transparent image sitting above blue frame causes
color change on frame where they overlap
* [User Interface] Folder icons are missing in file dialogues
* [General] barcode doesn't show readable text
* [Import / Export] Some issues with PDF import
* [Shape Drawing] Scribus crash if you delete a symbol during
in "symbol edit mode".
* [PDF] Drop shadow of very large shapes shows up wrong in
exported PDF
* [User Interface] F12 shortcut does not affect Align and
Distribute palette
* [Canvas] Some objects from left masterpage are not rendered
* [Build System] Typo in Findpoppler.cmake?
* [Documentation] Readme file has dead link to Ghostscript
* [Usability] Scribus silently upgrades your file to the new format
* [PDF] Open path with stroke gradient SVG results in closed
path in PDF
* [PDF] PDFs with layers do not allow layer exclusion when printing
on Mac and Windows using Adobe Reader or FoxIt PDF Reader
* [General] Moving cursor with down arrow jump to end of next frame
* [Usability] If a right to left paragraph follows a left to right
paragraph, one of the paragraphs will not work properly
* [Story Editor / Text Frames] "Permanently replace missing font"
isnt permanent
* [Import / Export] CVG-import faulty
* [Build System] NetBSD: link against libexecinfo for
backtrace_symbols
* [User Interface] File selection dialog box always reverts to
small size
* [User Interface] Pixelated display in Enhanced Character Palette
* [User Interface] Section Default Numbering
* [User Interface] Scribus first start with tiny window
* [Scripter] Pdf export by python scripter embeds fonts which
should be subsetted
* [Import / Export] Inline image disappears when two sla containing
ones are merged
* [User Interface] Colors and Fills dialog too narrow
* [User Interface] PageItem Attribute dialog too small by default
* [Scripter] Provide the information about the page number being "shown"
- Drop patches, merged upstream:
* 0001-16734-Build-break-with-poppler-22.2.0.patch
* 0001-Small-update-vs-latest-code-in-poppler.patch
* 0001-16764-Build-break-with-poppler-22.03.0.patch
* 0001-Enforce-poppler-version-0.86.0.patch
* 0001-16764-Better-patch-avoid-a-memory-leak.patch
* 0001-Fix-build-with-poppler-22.04.0.patch
* scribus-1.5.8-poppler-22.09.0.patch
-------------------------------------------------------------------
Mon Aug 7 12:17:33 UTC 2023 - Christophe Marin <christophe@krop.fr>

BIN
scribus.keyring Normal file

Binary file not shown.

View File

@ -17,36 +17,22 @@
#
# Disable AI PDF import until scribus supports podofo 0.10
# (https://bugs.scribus.net/view.php?id=16948)
%if 0%{?suse_version} < 1550
%bcond_without podofo
%endif
%bcond_without released
Name: scribus
Version: 1.5.8
Version: 1.6.1
Release: 0
Summary: Page Layout and Desktop Publishing (DTP)
License: GPL-2.0-or-later
URL: https://www.scribus.net/
# https://sourceforge.net/projects/scribus/files/scribus-devel/1.5.8/
# https://sourceforge.net/projects/scribus/files/scribus/1.6.1/
Source0: %{name}-%{version}.tar.xz
%if %{with released}
Source1: %{name}-%{version}.tar.xz.asc
Source2: scribus.keyring
%endif
# PATCH-FIX-OPENSUSE
Patch0: 0001-Make-sure-information-displayed-on-the-about-window-.patch
# PATCH-FIX-UPSTREAM
Patch1: 0001-16734-Build-break-with-poppler-22.2.0.patch
# PATCH-FIX-UPSTREAM
Patch2: 0001-Small-update-vs-latest-code-in-poppler.patch
# PATCH-FIX-UPSTREAM
Patch3: 0001-16764-Build-break-with-poppler-22.03.0.patch
# PATCH-FIX-UPSTREAM
Patch4: 0001-Enforce-poppler-version-0.86.0.patch
# PATCH-FIX-UPSTREAM
Patch5: 0001-16764-Better-patch-avoid-a-memory-leak.patch
# PATCH-FIX-UPSTREAM
Patch6: 0001-Fix-build-with-poppler-22.04.0.patch
# PATCH-FIX-UPSTREAM
Patch7: scribus-1.5.8-poppler-22.09.0.patch
BuildRequires: cmake >= 3.14.0
BuildRequires: cups-devel
BuildRequires: dos2unix
@ -69,17 +55,18 @@ BuildRequires: libwpg-devel
BuildRequires: libzmf-devel
BuildRequires: pkgconfig
BuildRequires: python3-devel
BuildRequires: update-desktop-files
BuildRequires: cmake(Qt5Core) >= 5.14.0
BuildRequires: cmake(Qt5Gui) >= 5.14.0
BuildRequires: cmake(Qt5LinguistTools) >= 5.14.0
BuildRequires: cmake(Qt5Network) >= 5.14.0
BuildRequires: cmake(Qt5OpenGL) >= 5.14.0
BuildRequires: cmake(Qt5PrintSupport) >= 5.14.0
BuildRequires: cmake(Qt5Widgets) >= 5.14.0
BuildRequires: cmake(Qt5Xml) >= 5.14.0
BuildRequires: cmake(Qt5Gui)
BuildRequires: cmake(Qt5LinguistTools)
BuildRequires: cmake(Qt5Network)
BuildRequires: cmake(Qt5OpenGL)
BuildRequires: cmake(Qt5PrintSupport)
BuildRequires: cmake(Qt5Quick)
BuildRequires: cmake(Qt5Widgets)
BuildRequires: cmake(Qt5Xml)
BuildRequires: pkgconfig(GraphicsMagick)
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(libpng16)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(harfbuzz)
@ -90,15 +77,12 @@ BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(poppler)
BuildRequires: pkgconfig(poppler) > 21.03.0
BuildRequires: pkgconfig(zlib)
Requires: hicolor-icon-theme
Recommends: python3-Pillow
Recommends: python3-tk
# Only available in graphics for the moment
Recommends: uniconvertor
Recommends: scribus-doc
# Not packaged anymore
Provides: scribus-devel = %{version}
Obsoletes: scribus-devel < %{version}
@ -122,6 +106,11 @@ This package provides the documentation for Scribus.
# W: wrong-script-end-of-line-encoding
find . -type f \( -iname \*.py -o -iname \*.cpp -o -iname \*.h \) -exec dos2unix {} \;
# Unused test file still using QQC1
rm scribus/ui/qml/qtq_test1.qml
find . \( -name "*.py" -o -name "*.html" \) -exec sed -i 's#/usr/bin/env python.*#/usr/bin/python3#' {} \;
%build
# Don't use the %%cmake macro, it causes crashes when starting scribus
mkdir build
@ -150,13 +139,11 @@ mkdir -p %{buildroot}%{_datadir}/scribus/aboutData
mv %{buildroot}%{_datadir}/doc/scribus/{AUTHORS,COPYING,LINKS,TRANSLATION} %{buildroot}%{_datadir}/scribus/aboutData/
# Already in %%doc
rm -f %{buildroot}%{_datadir}/doc/scribus/{ChangeLog,README}
rm %{buildroot}%{_datadir}/doc/scribus/{ChangeLog,README}
%fdupes %{buildroot}%{_datadir}/doc/scribus
%fdupes %{buildroot}%{_datadir}/scribus
%suse_update_desktop_file -r scribus Qt Office WordProcessor
%files doc
%license COPYING
%doc ChangeLog README
@ -177,6 +164,7 @@ rm -f %{buildroot}%{_datadir}/doc/scribus/{ChangeLog,README}
%{_bindir}/scribus
%{_datadir}/applications/scribus.desktop
%{_datadir}/icons/hicolor/*/apps/scribus.png
%{_datadir}/icons/hicolor/*/mimetypes/application-vnd.scribus.png
%{_datadir}/metainfo/scribus.appdata.xml
%{_datadir}/mime/packages/scribus.xml
%{_datadir}/scribus/