scribus: fix patch

This commit is contained in:
tranzystorekk 2025-03-02 12:53:03 +01:00
parent 349edfad4e
commit 1c30652e76

View file

@ -3,90 +3,90 @@ index 92539d1..ac8e2eb 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp --- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp +++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -462,11 +462,11 @@ bool PdfPlug::convert(const QString& fn) @@ -462,11 +462,11 @@ bool PdfPlug::convert(const QString& fn)
if (dev->isOk()) if (dev->isOk())
{ {
- OCGs* ocg = pdfDoc->getOptContentConfig(); - OCGs* ocg = pdfDoc->getOptContentConfig();
+ POPPLER_CONST_25_02 OCGs* ocg = pdfDoc->getOptContentConfig(); + POPPLER_CONST_25_02 OCGs* ocg = pdfDoc->getOptContentConfig();
if (ocg && ocg->hasOCGs()) if (ocg && ocg->hasOCGs())
{ {
QStringList ocgNames; QStringList ocgNames;
- Array *order = ocg->getOrderArray(); - Array *order = ocg->getOrderArray();
+ POPPLER_CONST_25_02 Array *order = ocg->getOrderArray(); + POPPLER_CONST_25_02 Array *order = ocg->getOrderArray();
if (order) if (order)
{ {
for (int i = 0; i < order->getLength (); ++i) for (int i = 0; i < order->getLength (); ++i)
diff --git a/scribus/plugins/import/pdf/importpdfconfig.h b/scribus/plugins/import/pdf/importpdfconfig.h diff --git a/scribus/plugins/import/pdf/importpdfconfig.h b/scribus/plugins/import/pdf/importpdfconfig.h
index b922816..b3d35f0 100644 index b922816..7ae96a8 100644
--- a/scribus/plugins/import/pdf/importpdfconfig.h --- a/scribus/plugins/import/pdf/importpdfconfig.h
+++ b/scribus/plugins/import/pdf/importpdfconfig.h +++ b/scribus/plugins/import/pdf/importpdfconfig.h
@@ -15,6 +15,12 @@ for which a new license (GPL+exception) is in place. @@ -15,6 +15,12 @@ for which a new license (GPL+exception) is in place.
+ ((micro) * 1)) + ((micro) * 1))
#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO) #define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO)
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+#define POPPLER_CONST_25_02 const +#define POPPLER_CONST_25_02 const
+#else +#else
+#define POPPLER_CONST_25_02 +#define POPPLER_CONST_25_02
+#endif +#endif
+ +
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 82, 0) #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 82, 0)
#define POPPLER_CONST_082 const #define POPPLER_CONST_082 const
#else #else
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 0244c9f..72e11b4 100644 index 0244c9f..09a90f3 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp --- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp +++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -2932,7 +2932,7 @@ void SlaOutputDev::beginMarkedContent(const char *name, Object *dictRef) @@ -2932,7 +2932,7 @@ void SlaOutputDev::beginMarkedContent(const char *name, Object *dictRef)
{ {
if (dictRef->isNull()) if (dictRef->isNull())
return; return;
- OCGs *contentConfig = m_catalog->getOptContentConfig(); - OCGs *contentConfig = m_catalog->getOptContentConfig();
+ POPPLER_CONST_25_02 OCGs *contentConfig = m_catalog->getOptContentConfig(); + POPPLER_CONST_25_02 OCGs *contentConfig = m_catalog->getOptContentConfig();
OptionalContentGroup *oc; OptionalContentGroup *oc;
if (dictRef->isRef()) if (dictRef->isRef())
{ {
@@ -3081,10 +3081,11 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3081,10 +3081,11 @@ void SlaOutputDev::updateFont(GfxState *state)
SplashFontFile *fontFile; SplashFontFile *fontFile;
SplashFontSrc *fontsrc = nullptr; SplashFontSrc *fontsrc = nullptr;
Object refObj, strObj; Object refObj, strObj;
-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 4, 0) -#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 4, 0)
- int tmpBufLen = 0; - int tmpBufLen = 0;
-#endif -#endif
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ std::vector<int> codeToGID; + std::vector<int> codeToGID;
+#else +#else
int *codeToGID = nullptr; int *codeToGID = nullptr;
+#endif +#endif
const double *textMat = nullptr; const double *textMat = nullptr;
double m11, m12, m21, m22, fontSize; double m11, m12, m21, m22, fontSize;
SplashCoord mat[4] = { 1.0, 0.0, 0.0, 1.0 }; SplashCoord mat[4] = { 1.0, 0.0, 0.0, 1.0 };
@@ -3244,10 +3245,20 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3244,10 +3245,20 @@ void SlaOutputDev::updateFont(GfxState *state)
} }
else else
{ {
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ codeToGID.clear(); + codeToGID.clear();
+#else +#else
codeToGID = nullptr; codeToGID = nullptr;
+#endif +#endif
n = 0; n = 0;
} }
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, std::move(codeToGID), fontLoc->fontNum))) + if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, std::move(codeToGID), fontLoc->fontNum)))
+ { + {
+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
+ goto err2; + goto err2;
+ } + }
+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, codeToGID, n, fontLoc->fontNum))) if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, codeToGID, n, fontLoc->fontNum)))
{ {
error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
@@ -3278,6 +3289,18 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3278,6 +3289,18 @@ void SlaOutputDev::updateFont(GfxState *state)
#endif #endif
break; break;
case fontCIDType0COT: case fontCIDType0COT:
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ if (((GfxCIDFont*) gfxFont)->getCIDToGIDLen() > 0) + if (((GfxCIDFont*) gfxFont)->getCIDToGIDLen() > 0)
+ { + {
@ -99,14 +99,14 @@ index 0244c9f..72e11b4 100644
+ n = 0; + n = 0;
+ } + }
+#else +#else
if (((GfxCIDFont *) gfxFont)->getCIDToGID()) if (((GfxCIDFont *) gfxFont)->getCIDToGID())
{ {
n = ((GfxCIDFont *) gfxFont)->getCIDToGIDLen(); n = ((GfxCIDFont *) gfxFont)->getCIDToGIDLen();
@@ -3289,7 +3312,15 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3289,7 +3312,15 @@ void SlaOutputDev::updateFont(GfxState *state)
codeToGID = nullptr; codeToGID = nullptr;
n = 0; n = 0;
} }
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
+#endif +#endif
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(std::move(id), fontsrc, std::move(codeToGID), fontLoc->fontNum))) + if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(std::move(id), fontsrc, std::move(codeToGID), fontLoc->fontNum)))
@ -115,14 +115,14 @@ index 0244c9f..72e11b4 100644
+ gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
+ goto err2; + goto err2;
+ } + }
+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(std::move(id), fontsrc, codeToGID, n, fontLoc->fontNum))) if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(std::move(id), fontsrc, codeToGID, n, fontLoc->fontNum)))
{ {
error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
@@ -3307,6 +3338,15 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3307,6 +3338,15 @@ void SlaOutputDev::updateFont(GfxState *state)
break; break;
case fontCIDType2: case fontCIDType2:
case fontCIDType2OT: case fontCIDType2OT:
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ codeToGID.clear(); + codeToGID.clear();
+ n = 0; + n = 0;
@ -132,41 +132,41 @@ index 0244c9f..72e11b4 100644
+ n = codeToGID.size(); + n = codeToGID.size();
+ } + }
+#else +#else
codeToGID = nullptr; codeToGID = nullptr;
n = 0; n = 0;
if (((GfxCIDFont *) gfxFont)->getCIDToGID()) if (((GfxCIDFont *) gfxFont)->getCIDToGID())
@@ -3318,6 +3358,7 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3318,6 +3358,7 @@ void SlaOutputDev::updateFont(GfxState *state)
memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(*codeToGID)); memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(*codeToGID));
} }
} }
+#endif +#endif
else else
{ {
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
@@ -3338,15 +3379,20 @@ void SlaOutputDev::updateFont(GfxState *state) @@ -3338,15 +3379,20 @@ void SlaOutputDev::updateFont(GfxState *state)
#endif #endif
if (! ff) if (! ff)
goto err2; goto err2;
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
- codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n); +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
- ff.reset();
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get()); + codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get());
#else +#else
- codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n); codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);
- delete ff; +#endif
+ codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n); ff.reset();
#endif -#else
+ ff.reset(); - codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
} - delete ff;
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) -#endif
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0) + }
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 2, 0)
+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, std::move(codeToGID), fontLoc->fontNum))) + if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, std::move(codeToGID), fontLoc->fontNum)))
+ { + {
+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
+ goto err2; + goto err2;
+ } }
+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0) -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, codeToGID, n, fontLoc->fontNum))) +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
{ if (!(fontFile = m_fontEngine->loadTrueTypeFont(std::move(id), fontsrc, codeToGID, n, fontLoc->fontNum)))
error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); {
error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");