Hi,

this fixes the  build of print/scribus with an upcoming update of
print/poppler.

It would be really nice if anyone using scribus could test wether
this also works with the version of poppler we now have in the tree
(24.12.0), because it would allow to commit it before the poppler
update.

Ciao,
        Kili

Index: Makefile
===================================================================
RCS file: /cvs/ports/print/scribus/Makefile,v
diff -u -p -r1.94 Makefile
--- Makefile    21 Dec 2024 11:38:39 -0000      1.94
+++ Makefile    3 Jan 2025 23:24:56 -0000
@@ -3,7 +3,7 @@ DPB_PROPERTIES= parallel
 COMMENT=       desktop publishing program
 DISTNAME=      scribus-1.6.2
 CATEGORIES=    print
-REVISION=      1
+REVISION=      2
 
 HOMEPAGE=      https://www.scribus.net/
 
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.12 patch-scribus_plugins_import_pdf_slaoutput_cpp
--- patches/patch-scribus_plugins_import_pdf_slaoutput_cpp      6 Dec 2024 
07:13:26 -0000       1.12
+++ patches/patch-scribus_plugins_import_pdf_slaoutput_cpp      3 Jan 2025 
23:24:56 -0000
@@ -1,6 +1,6 @@
-Fix build with poppler-24.10.0.
+Fix build with poppler-25.01.0.
 
-From upstream commits 26325, 26327, 26392 and 26394.
+From upstream commits 26325, 26327, 26392, 26394 and 26558.
 
 Index: scribus/plugins/import/pdf/slaoutput.cpp
 --- scribus/plugins/import/pdf/slaoutput.cpp.orig
@@ -36,21 +36,53 @@ Index: scribus/plugins/import/pdf/slaout
  LinkImportData::LinkImportData(Object *actionObj)
  {
        if (!actionObj->isDict())
-@@ -167,13 +171,8 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER
+@@ -120,21 +124,15 @@ LinkImportData::LinkImportData(Object *actionObj)
+               return;
+ 
+       Object obj3 = getFileSpecNameForPlatform(&obj1);
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 01, 0)
+       if (!obj3.isNull())
+               fileName = obj3.getString()->copy();
++#else
++      if (!obj3.isNull())
++              fileName.reset(obj3.getString()->copy());
++#endif
+ }
+ 
+-LinkImportData::~LinkImportData()
+-{
+-      delete fileName;
+-}
+-
+-AnoOutputDev::~AnoOutputDev()
+-{
+-      delete fontName;
+-      delete itemText;
+-}
+-
+ AnoOutputDev::AnoOutputDev(ScribusDoc* doc, QStringList *importedColors)
+ {
+       m_doc = doc;
+@@ -167,14 +165,13 @@ 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
+-              fontName = new GooString(state->getFont()->getName().value());
++              fontName.reset(new 
GooString(state->getFont()->getName().value()));
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(25, 01, 0)
++      itemText = s->copy();
+ #else
 -      if (state->getFont())
 -              fontName = state->getFont()->getName()->copy();
--#endif
-       itemText = s->copy();
++      itemText.reset(s->copy());
+ #endif
+-      itemText = s->copy();
  }
  
-@@ -359,30 +358,25 @@ LinkAction* SlaOutputDev::SC_getAdditionalAction(const
+ QString AnoOutputDev::getColor(GfxColorSpace *color_space, POPPLER_CONST_070 
GfxColor *color, int *shade)
+@@ -359,30 +356,25 @@ LinkAction* SlaOutputDev::SC_getAdditionalAction(const
  GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
  {
        auto *dev = (SlaOutputDev*) user_data;
@@ -92,7 +124,7 @@ Index: scribus/plugins/import/pdf/slaout
        }
        bool retVal = true;
        if (annota->getType() == Annot::typeText)
-@@ -701,12 +695,8 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, do
+@@ -701,12 +693,8 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, do
                        if (apa || !achar)
                        {
                                auto *annotOutDev = new AnoOutputDev(m_doc, 
m_importedColors);
@@ -105,7 +137,18 @@ Index: scribus/plugins/import/pdf/slaout
                                ano->draw(gfx, false);
                                if (!bgFound)
                                        m_graphicStack.top().fillColor = 
annotOutDev->currColorFill;
-@@ -1078,6 +1068,30 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
+@@ -714,8 +702,8 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, do
+                                       m_graphicStack.top().strokeColor = 
annotOutDev->currColorStroke;
+                               currTextColor = annotOutDev->currColorText;
+                               fontSize = annotOutDev->fontSize;
+-                              fontName = 
UnicodeParsedString(annotOutDev->fontName);
+-                              itemText = 
UnicodeParsedString(annotOutDev->itemText);
++                              fontName = 
UnicodeParsedString(annotOutDev->fontName.get());
++                              itemText = 
UnicodeParsedString(annotOutDev->itemText.get());
+                               delete gfx;
+                               delete annotOutDev;
+                       }
+@@ -1078,6 +1066,30 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
                                }
                        }
                }
@@ -136,7 +179,7 @@ Index: scribus/plugins/import/pdf/slaout
                else if (Lact->getKind() == actionUnknown)
                {
                        auto *uno = (LinkUnknown*) Lact;
-@@ -1106,7 +1120,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
+@@ -1106,7 +1118,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
                                                if (impo->isOk())
                                                {
                                                        
ite->annotation().setActionType(3);
@@ -145,7 +188,7 @@ 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)
+@@ -3049,13 +3061,14 @@ void SlaOutputDev::updateFont(GfxState *state)
        char* tmpBuf = nullptr;
  #endif
        GfxFontType fontType;
@@ -163,7 +206,7 @@ Index: scribus/plugins/import/pdf/slaout
        int *codeToGID = nullptr;
        const double *textMat = nullptr;
        double m11, m12, m21, m22, fontSize;
-@@ -3066,11 +3081,7 @@ void SlaOutputDev::updateFont(GfxState *state)
+@@ -3066,11 +3079,7 @@ void SlaOutputDev::updateFont(GfxState *state)
  
        m_font = nullptr;
  
@@ -175,7 +218,7 @@ Index: scribus/plugins/import/pdf/slaout
        if (!gfxFont)
                goto err1;
  
-@@ -3079,9 +3090,15 @@ void SlaOutputDev::updateFont(GfxState *state)
+@@ -3079,9 +3088,15 @@ void SlaOutputDev::updateFont(GfxState *state)
                goto err1;
  
        // check the font file cache
@@ -191,7 +234,7 @@ Index: scribus/plugins/import/pdf/slaout
        else
        {
                fontLoc = gfxFont->locateFont(m_xref ? m_xref : 
m_pdfDoc->getXRef(), nullptr);
-@@ -3135,30 +3152,59 @@ void SlaOutputDev::updateFont(GfxState *state)
+@@ -3135,30 +3150,59 @@ void SlaOutputDev::updateFont(GfxState *state)
                // load the font file
                switch (fontType) {
                case fontType1:
@@ -252,7 +295,7 @@ Index: scribus/plugins/import/pdf/slaout
                                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)
+@@ -3184,19 +3228,35 @@ void SlaOutputDev::updateFont(GfxState *state)
                                codeToGID = nullptr;
                                n = 0;
                        }
@@ -288,7 +331,7 @@ Index: scribus/plugins/import/pdf/slaout
                        break;
                case fontCIDType0COT:
                        if (((GfxCIDFont *) gfxFont)->getCIDToGID())
-@@ -3210,12 +3272,21 @@ void SlaOutputDev::updateFont(GfxState *state)
+@@ -3210,12 +3270,21 @@ void SlaOutputDev::updateFont(GfxState *state)
                                codeToGID = nullptr;
                                n = 0;
                        }
@@ -310,7 +353,7 @@ Index: scribus/plugins/import/pdf/slaout
                        break;
                case fontCIDType2:
                case fontCIDType2OT:
-@@ -3232,8 +3303,13 @@ void SlaOutputDev::updateFont(GfxState *state)
+@@ -3232,8 +3301,13 @@ void SlaOutputDev::updateFont(GfxState *state)
                        }
                        else
                        {
@@ -325,7 +368,7 @@ Index: scribus/plugins/import/pdf/slaout
                                        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)
+@@ -3253,11 +3327,19 @@ void SlaOutputDev::updateFont(GfxState *state)
                                delete ff;
  #endif
                        }
@@ -345,7 +388,7 @@ Index: scribus/plugins/import/pdf/slaout
                        break;
                default:
                        // this shouldn't happen
-@@ -3292,7 +3376,11 @@ void SlaOutputDev::updateFont(GfxState *state)
+@@ -3292,7 +3374,11 @@ void SlaOutputDev::updateFont(GfxState *state)
        return;
  
  err2:
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.8 patch-scribus_plugins_import_pdf_slaoutput_h
--- patches/patch-scribus_plugins_import_pdf_slaoutput_h        6 Dec 2024 
07:13:26 -0000       1.8
+++ patches/patch-scribus_plugins_import_pdf_slaoutput_h        3 Jan 2025 
23:24:56 -0000
@@ -1,6 +1,6 @@
-Fix build with poppler-24.10.0.
+Fix build with poppler-25.01.0.
 
-From upstream commits 26325, 26327, 26392 and 26429.
+From upstream commits 26325, 26327, 26392, 26429 and 26558.
 
 Index: scribus/plugins/import/pdf/slaoutput.h
 --- scribus/plugins/import/pdf/slaoutput.h.orig
@@ -14,7 +14,7 @@ Index: scribus/plugins/import/pdf/slaout
  #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.
+@@ -56,29 +54,33 @@ for which a new license (GPL+exception) is in place.
  #include <poppler/splash/SplashGlyphBitmap.h>
  
  //------------------------------------------------------------------------
@@ -27,8 +27,12 @@ Index: scribus/plugins/import/pdf/slaout
  class LinkSubmitForm: public LinkAction
  {
  public:
-@@ -68,17 +68,19 @@ class LinkSubmitForm: public LinkAction (public)
-       virtual ~LinkSubmitForm();
+       // Build a LinkImportData from an action dictionary.
+-      LinkSubmitForm(Object *actionObj);
++      explicit LinkSubmitForm(Object *actionObj);
+       // Destructor.
+-      virtual ~LinkSubmitForm();
++      ~LinkSubmitForm() override;
  
        // Was the LinkImportData created successfully?
 -      GBool isOk() POPPLER_CONST override { return fileName != nullptr; }
@@ -36,8 +40,9 @@ Index: scribus/plugins/import/pdf/slaout
        // Accessors.
        LinkActionKind getKind() POPPLER_CONST override { return actionUnknown; 
}
 -      GooString *getFileName() { return fileName; }
+-      int getFlags() { return m_flags; }
 +      GooString *getFileName() { return m_url; }
-       int getFlags() { return m_flags; }
++      int getFlags() const { return m_flags; }
  
  private:
 -      GooString *fileName {nullptr};          // file name
@@ -50,19 +55,29 @@ Index: scribus/plugins/import/pdf/slaout
  //------------------------------------------------------------------------
  // LinkImportData
  //------------------------------------------------------------------------
-@@ -87,9 +89,9 @@ class LinkImportData: public LinkAction
+@@ -87,18 +89,16 @@ class LinkImportData: public LinkAction
  {
  public:
        // Build a LinkImportData from an action dictionary.
 -      LinkImportData(Object *actionObj);
-+      explicit LinkImportData(Object *actionObj);
-       // Destructor.
+-      // Destructor.
 -      virtual ~LinkImportData();
-+      ~LinkImportData() override;
++      explicit LinkImportData(Object *actionObj);
  
        // Was the LinkImportData created successfully?
        GBool isOk() POPPLER_CONST override { return fileName != nullptr; }
-@@ -108,13 +110,19 @@ class LinkImportData: public LinkAction
+       // Accessors.
+       LinkActionKind getKind() POPPLER_CONST override { return actionUnknown; 
}
+-      GooString *getFileName() { return fileName; }
++      GooString* getFileName() { return fileName.get(); }
+ 
+ private:
+-      GooString *fileName {nullptr};          // file name
++      std::unique_ptr<GooString> fileName;            // file name
+ };
+ 
+ //------------------------------------------------------------------------
+@@ -108,13 +108,19 @@ class LinkImportData: public LinkAction
  class SlaOutFontFileID: public SplashFontFileID
  {
  public:
@@ -84,7 +99,18 @@ Index: scribus/plugins/import/pdf/slaout
  
  private:
        Ref r;
-@@ -160,7 +168,7 @@ class SlaOutputDev : public OutputDev
+@@ -145,8 +151,8 @@ class AnoOutputDev : public OutputDev (public)
+       QString currColorFill;
+       QString currColorStroke;
+       double  fontSize {12};
+-      GooString *fontName {nullptr};
+-      GooString *itemText {nullptr};
++      std::unique_ptr<GooString> fontName;
++      std::unique_ptr<GooString> itemText;
+ 
+ private:
+       QString getColor(GfxColorSpace *color_space, POPPLER_CONST_070 GfxColor 
*color, int *shade);
+@@ -160,7 +166,7 @@ class SlaOutputDev : public OutputDev
  {
  public:
        SlaOutputDev(ScribusDoc* doc, QList<PageItem*> *Elements, QStringList 
*importedColors, int flags);

Reply via email to