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