Download raw body.
fix print/scribus
Fix build with poppler-24.12.
Lightly tested by importing a PDF.
If there are no objections, I'll commit this right after the poppler
update.
Ciao,
Kili
Index: Makefile
===================================================================
RCS file: /cvs/ports/print/scribus/Makefile,v
diff -u -p -r1.92 Makefile
--- Makefile 29 Jul 2024 08:15:04 -0000 1.92
+++ Makefile 5 Dec 2024 19:04:44 -0000
@@ -3,6 +3,7 @@ DPB_PROPERTIES= parallel
COMMENT= desktop publishing program
DISTNAME= scribus-1.6.2
CATEGORIES= print
+REVISION= 0
HOMEPAGE= https://www.scribus.net/
Index: patches/patch-scribus_plugins_import_pdf_pdftextrecognition_h
===================================================================
RCS file: patches/patch-scribus_plugins_import_pdf_pdftextrecognition_h
diff -N patches/patch-scribus_plugins_import_pdf_pdftextrecognition_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-scribus_plugins_import_pdf_pdftextrecognition_h 5 Dec 2024 19:04:44 -0000
@@ -0,0 +1,24 @@
+Fix build with poppler-24.10.0.
+
+From upstream commmit 26429.
+
+Index: scribus/plugins/import/pdf/pdftextrecognition.h
+--- scribus/plugins/import/pdf/pdftextrecognition.h.orig
++++ scribus/plugins/import/pdf/pdftextrecognition.h
+@@ -16,7 +16,6 @@ for which a new license (GPL+exception) is in place.
+ #include "slaoutput.h"
+
+ #include <poppler/GfxState.h>
+-#include <poppler/CharCodeToUnicode.h>
+
+ /* PDF TextBox Framework */
+ /*
+@@ -143,7 +142,7 @@ class PdfTextOutputDev : public SlaOutputDev
+ {
+ public:
+ PdfTextOutputDev(ScribusDoc* doc, QList<PageItem*>* Elements, QStringList* importedColors, int flags);
+- virtual ~PdfTextOutputDev();
++ ~PdfTextOutputDev() override;
+
+ void updateFont(GfxState* state) override;
+
Index: patches/patch-scribus_plugins_import_pdf_slaoutput_cpp
===================================================================
RCS file: /cvs/ports/print/scribus/patches/patch-scribus_plugins_import_pdf_slaoutput_cpp,v
diff -u -p -r1.11 patch-scribus_plugins_import_pdf_slaoutput_cpp
--- patches/patch-scribus_plugins_import_pdf_slaoutput_cpp 24 Oct 2024 19:10:53 -0000 1.11
+++ patches/patch-scribus_plugins_import_pdf_slaoutput_cpp 5 Dec 2024 19:04:44 -0000
@@ -1,4 +1,6 @@
-Fix build with poppler-24.10.0. From upstream commits 26325 and 26327.
+Fix build with poppler-24.10.0.
+
+From upstream commits 26325, 26327, 26392 and 26394.
Index: scribus/plugins/import/pdf/slaoutput.cpp
--- scribus/plugins/import/pdf/slaoutput.cpp.orig
@@ -34,7 +36,76 @@ Index: scribus/plugins/import/pdf/slaout
LinkImportData::LinkImportData(Object *actionObj)
{
if (!actionObj->isDict())
-@@ -1078,6 +1082,30 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
+@@ -167,13 +171,8 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER
+ 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();
+ }
+
+@@ -359,30 +358,25 @@ LinkAction* SlaOutputDev::SC_getAdditionalAction(const
+ GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
+ {
+ auto *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;
+- double height = box->y2 - box->y1;
++ const PDFRectangle& box = annota->getRect();
++ 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;
++ double height = box.y2 - box.y1;
+ if (dev->rotate == 90)
+ {
+- xCoor = dev->m_doc->currentPage()->xOffset() - dev->cropOffsetX + box->y2;
+- yCoor = dev->m_doc->currentPage()->yOffset() + dev->cropOffsetY + box->x1;
++ xCoor = dev->m_doc->currentPage()->xOffset() - dev->cropOffsetX + box.y2;
++ yCoor = dev->m_doc->currentPage()->yOffset() + dev->cropOffsetY + box.x1;
+ }
+ else if (dev->rotate == 180)
+ {
+- xCoor = dev->m_doc->currentPage()->xOffset() - dev->cropOffsetX + dev->m_doc->currentPage()->width() - box->x1;
+- yCoor = dev->m_doc->currentPage()->yOffset() + dev->cropOffsetY + box->y2;
++ xCoor = dev->m_doc->currentPage()->xOffset() - dev->cropOffsetX + dev->m_doc->currentPage()->width() - box.x1;
++ yCoor = dev->m_doc->currentPage()->yOffset() + dev->cropOffsetY + box.y2;
+ }
+ else if (dev->rotate == 270)
+ {
+- xCoor = dev->m_doc->currentPage()->xOffset() - dev->cropOffsetX + dev->m_doc->currentPage()->width() - box->y2;
+- yCoor = dev->m_doc->currentPage()->yOffset() + dev->cropOffsetY + dev->m_doc->currentPage()->height() - box->x1;
++ xCoor = dev->m_doc->currentPage()->xOffset() - dev->cropOffsetX + dev->m_doc->currentPage()->width() - box.y2;
++ yCoor = dev->m_doc->currentPage()->yOffset() + dev->cropOffsetY + dev->m_doc->currentPage()->height() - box.x1;
+ }
+ bool retVal = true;
+ if (annota->getType() == Annot::typeText)
+@@ -701,12 +695,8 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, do
+ if (apa || !achar)
+ {
+ auto *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
+ const PDFRectangle& annotaRect = annota->getRect();
+ auto* gfx = new Gfx(m_pdfDoc, annotOutDev, m_pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);
+-#else
+- auto* gfx = new Gfx(m_pdfDoc, annotOutDev, m_pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);
+-#endif
+ ano->draw(gfx, false);
+ if (!bgFound)
+ m_graphicStack.top().fillColor = annotOutDev->currColorFill;
+@@ -1078,6 +1068,30 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
}
}
}
@@ -65,7 +136,7 @@ Index: scribus/plugins/import/pdf/slaout
else if (Lact->getKind() == actionUnknown)
{
auto *uno = (LinkUnknown*) Lact;
-@@ -1106,7 +1134,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
+@@ -1106,7 +1120,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
if (impo->isOk())
{
ite->annotation().setActionType(3);
@@ -74,3 +145,215 @@ Index: scribus/plugins/import/pdf/slaout
int fl = impo->getFlags();
if (fl == 0)
ite->annotation().setHTML(0);
+@@ -3049,13 +3063,14 @@ void SlaOutputDev::updateFont(GfxState *state)
+ char* tmpBuf = nullptr;
+ #endif
+ GfxFontType fontType;
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ std::unique_ptr<SlaOutFontFileID> id;
++#else
+ SlaOutFontFileID *id;
++#endif
+ SplashFontFile *fontFile;
+ SplashFontSrc *fontsrc = nullptr;
+ Object refObj, strObj;
+-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 4, 0)
+- int tmpBufLen = 0;
+-#endif
+ int *codeToGID = nullptr;
+ const double *textMat = nullptr;
+ double m11, m12, m21, m22, fontSize;
+@@ -3066,11 +3081,7 @@ void SlaOutputDev::updateFont(GfxState *state)
+
+ m_font = nullptr;
+
+-#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;
+
+@@ -3079,9 +3090,15 @@ void SlaOutputDev::updateFont(GfxState *state)
+ goto err1;
+
+ // check the font file cache
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ id = std::make_unique<SlaOutFontFileID>(gfxFont->getID());
++ if ((fontFile = m_fontEngine->getFontFile(*id)))
++ id.reset();
++#else
+ id = new SlaOutFontFileID(gfxFont->getID());
+ if ((fontFile = m_fontEngine->getFontFile(id)))
+ delete id;
++#endif
+ else
+ {
+ fontLoc = gfxFont->locateFont(m_xref ? m_xref : m_pdfDoc->getXRef(), nullptr);
+@@ -3135,30 +3152,59 @@ void SlaOutputDev::updateFont(GfxState *state)
+ // load the font file
+ switch (fontType) {
+ case fontType1:
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ if (!(fontFile = m_fontEngine->loadType1Font(std::move(id), fontsrc, (const char**) ((Gfx8BitFont*) gfxFont)->getEncoding(), fontLoc->fontNum)))
++ {
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
++ goto err2;
++ }
++#else
+ 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)");
+ goto err2;
+ }
++#endif
+ break;
+ case fontType1C:
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ if (!(fontFile = m_fontEngine->loadType1CFont(std::move(id), fontsrc, (const char**) ((Gfx8BitFont*) gfxFont)->getEncoding(), fontLoc->fontNum)))
++ {
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
++ goto err2;
++ }
++#else
+ 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)");
+ goto err2;
+ }
++#endif
+ break;
+ case fontType1COT:
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(std::move(id), fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding(), fontLoc->fontNum)))
++ {
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
++ goto err2;
++ }
++#else
+ 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)");
+ goto err2;
+ }
++#endif
+ break;
+ case fontTrueType:
+ case fontTrueTypeOT:
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
+ if (!fileName.empty())
++ ff = FoFiTrueType::load(fileName.c_str(), fontLoc->fontNum);
++ else
++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size(), fontLoc->fontNum);
++#elif 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());
+@@ -3184,19 +3230,35 @@ void SlaOutputDev::updateFont(GfxState *state)
+ codeToGID = nullptr;
+ n = 0;
+ }
++#if 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)");
++ goto err2;
++ }
++#else
+ 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)");
+ goto err2;
+ }
++#endif
+ break;
+ case fontCIDType0:
+ case fontCIDType0C:
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ if (!(fontFile = m_fontEngine->loadCIDFont(std::move(id), fontsrc, fontLoc->fontNum)))
++ {
++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
++ goto err2;
++ }
++#else
+ if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))
+ {
+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
+ goto err2;
+ }
++#endif
+ break;
+ case fontCIDType0COT:
+ if (((GfxCIDFont *) gfxFont)->getCIDToGID())
+@@ -3210,12 +3272,21 @@ void SlaOutputDev::updateFont(GfxState *state)
+ codeToGID = nullptr;
+ n = 0;
+ }
++#if 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}'",
++ gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)");
++ goto err2;
++ }
++#else
+ 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)");
+ goto err2;
+ }
++#endif
+ break;
+ case fontCIDType2:
+ case fontCIDType2OT:
+@@ -3232,8 +3303,13 @@ void SlaOutputDev::updateFont(GfxState *state)
+ }
+ else
+ {
+-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
+ if (!fileName.empty())
++ ff = FoFiTrueType::load(fileName.c_str(), fontLoc->fontNum);
++ else
++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size(), fontLoc->fontNum);
++#elif 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());
+@@ -3253,11 +3329,19 @@ void SlaOutputDev::updateFont(GfxState *state)
+ delete ff;
+ #endif
+ }
++#if 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)");
++ goto err2;
++ }
++#else
+ 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)");
+ goto err2;
+ }
++#endif
+ break;
+ default:
+ // this shouldn't happen
+@@ -3292,7 +3376,11 @@ void SlaOutputDev::updateFont(GfxState *state)
+ return;
+
+ err2:
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ id.reset();
++#else
+ delete id;
++#endif
+ #if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
+ delete fontLoc;
+ #endif
Index: patches/patch-scribus_plugins_import_pdf_slaoutput_h
===================================================================
RCS file: /cvs/ports/print/scribus/patches/patch-scribus_plugins_import_pdf_slaoutput_h,v
diff -u -p -r1.7 patch-scribus_plugins_import_pdf_slaoutput_h
--- patches/patch-scribus_plugins_import_pdf_slaoutput_h 24 Oct 2024 19:10:53 -0000 1.7
+++ patches/patch-scribus_plugins_import_pdf_slaoutput_h 5 Dec 2024 19:04:44 -0000
@@ -1,9 +1,20 @@
-Fix build with poppler-24.10.0. From upstream commits 26325 and 26327.
+Fix build with poppler-24.10.0.
+
+From upstream commits 26325, 26327, 26392 and 26429.
Index: scribus/plugins/import/pdf/slaoutput.h
--- scribus/plugins/import/pdf/slaoutput.h.orig
+++ scribus/plugins/import/pdf/slaoutput.h
-@@ -56,9 +56,11 @@ for which a new license (GPL+exception) is in place.
+@@ -45,8 +45,6 @@ for which a new license (GPL+exception) is in place.
+ #include <poppler/Form.h>
+ #include <poppler/Page.h>
+ #include <poppler/Catalog.h>
+-#include <poppler/CharCodeToUnicode.h>
+-#include <poppler/FontEncodingTables.h>
+ #include <poppler/splash/SplashFontFileID.h>
+ #include <poppler/splash/SplashFontFile.h>
+ #include <poppler/splash/SplashFontEngine.h>
+@@ -56,9 +54,11 @@ for which a new license (GPL+exception) is in place.
#include <poppler/splash/SplashGlyphBitmap.h>
//------------------------------------------------------------------------
@@ -16,7 +27,7 @@ Index: scribus/plugins/import/pdf/slaout
class LinkSubmitForm: public LinkAction
{
public:
-@@ -68,16 +70,18 @@ class LinkSubmitForm: public LinkAction (public)
+@@ -68,17 +68,19 @@ class LinkSubmitForm: public LinkAction (public)
virtual ~LinkSubmitForm();
// Was the LinkImportData created successfully?
@@ -33,8 +44,52 @@ Index: scribus/plugins/import/pdf/slaout
+ GooString *m_url {nullptr}; // URL
int m_flags {0};
};
-+
-+#endif
++#endif
++
//------------------------------------------------------------------------
// LinkImportData
+ //------------------------------------------------------------------------
+@@ -87,9 +89,9 @@ class LinkImportData: public LinkAction
+ {
+ public:
+ // Build a LinkImportData from an action dictionary.
+- LinkImportData(Object *actionObj);
++ explicit LinkImportData(Object *actionObj);
+ // Destructor.
+- virtual ~LinkImportData();
++ ~LinkImportData() override;
+
+ // Was the LinkImportData created successfully?
+ GBool isOk() POPPLER_CONST override { return fileName != nullptr; }
+@@ -108,13 +110,19 @@ class LinkImportData: public LinkAction
+ class SlaOutFontFileID: public SplashFontFileID
+ {
+ public:
+- SlaOutFontFileID(const Ref *rA) { r = *rA; }
+- ~SlaOutFontFileID() {}
++ explicit SlaOutFontFileID(const Ref *rA) { r = *rA; }
+
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 11, 0)
++ bool matches(const SplashFontFileID& id) const override
++ {
++ return ((const SlaOutFontFileID&) id).r.num == r.num && ((const SlaOutFontFileID&) id).r.gen == r.gen;
++ }
++#else
+ GBool matches(SplashFontFileID *id) override
+ {
+ return ((SlaOutFontFileID*) id)->r.num == r.num && ((SlaOutFontFileID *) id)->r.gen == r.gen;
+ }
++#endif
+
+ private:
+ Ref r;
+@@ -160,7 +168,7 @@ class SlaOutputDev : public OutputDev
+ {
+ public:
+ SlaOutputDev(ScribusDoc* doc, QList<PageItem*> *Elements, QStringList *importedColors, int flags);
+- virtual ~SlaOutputDev();
++ ~SlaOutputDev() override;
+
+ LinkAction* SC_getAction(AnnotWidget *ano);
+ #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
fix print/scribus