From 3c29b709cd2b5b18776b3c15638b66bd8a7dcb07 Mon Sep 17 00:00:00 2001
From: Xisco Fauli <xiscofauli@libreoffice.org>
Date: Fri, 06 Feb 2026 00:53:12 +0100
Subject: [PATCH] poppler: upgrade to 26.02.0

* external/poppler/missinginclude.patch has been fixed upstream

Downloaded from https://poppler.freedesktop.org/poppler-26.02.0.tar.x

Change-Id: I7641b7b544e853a86563dbe312af4b36444dea8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198803
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
---

diff --git a/download.lst b/download.lst
index c4d8a03..4bdba86 100644
--- libreoffice-26.2.1.1/download.lst
+++ libreoffice-26.2.1.1/download.lst
@@ -599,8 +599,8 @@
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-POPPLER_SHA256SUM := 1cb944a4b88847f5fb6551683bc799db59f04990f5d8be07aba2acbf38601089
-POPPLER_TARBALL := poppler-26.01.0.tar.xz
+POPPLER_SHA256SUM := dded8621f7b2f695c91063aab1558691c8418374cd583501e89ed39487e7ab77
+POPPLER_TARBALL := poppler-26.02.0.tar.xz
 POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74
 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz
 # three static lines
--- libreoffice-26.2.1.1/external/poppler/UnpackedTarball_poppler.mk.old
+++ libreoffice-26.2.1.1/external/poppler/UnpackedTarball_poppler.mk
@@ -16,7 +16,6 @@
 $(eval $(call gb_UnpackedTarball_add_patches,poppler,\
 	external/poppler/disable-freetype.patch.1 \
 	external/poppler/clang-std-ranges.patch.1 \
-	external/poppler/poppler-config.patch.1 \
 ))
 
 ifneq ($(filter -fsanitize=%,$(CC)),)
diff --git a/external/poppler/disable-freetype.patch.1 b/external/poppler/disable-freetype.patch.1
index 98e00cd..49a76ec 100644
--- libreoffice-26.2.1.1/external/poppler/disable-freetype.patch.1
+++ libreoffice-26.2.1.1/external/poppler/disable-freetype.patch.1
@@ -32,25 +32,25 @@
      if (!filepath.ends_with(".ttf") && !filepath.ends_with(".ttc") && !filepath.ends_with(".otf")) {
          error(errIO, -1, "We only support embedding ttf/ttc/otf fonts for now. The font file for {0:s} {1:s} was {2:s}", fontFamily.c_str(), fontStyle.c_str(), filepath.c_str());
          return {};
-@@ -2994,6 +2996,7 @@
+@@ -2974,6 +2974,7 @@
      }
  
-     return { dictFontName, fontDictRef };
+     return { .fontName = dictFontName, .ref = fontDictRef };
 +#endif
  }
  
  std::string Form::getFallbackFontForChar(Unicode uChar, const GfxFont &fontToEmulate) const
 --- poppler/splash/SplashFontEngine.cc.orig	2024-02-21 01:28:10.479645185 +0000
 +++ popller/splash/SplashFontEngine.cc	2023-09-05 22:15:14.000000000 +0100
-@@ -66,7 +66,7 @@
+@@ -59,8 +59,6 @@
+     for (auto *font : fontCache) {
          delete font;
      }
- 
+-
 -    delete ftEngine;
-+    //delete ftEngine;
  }
  
- SplashFontFile *SplashFontEngine::getFontFile(const SplashFontFileID &id)
+ std::shared_ptr<SplashFontFile> SplashFontEngine::getFontFile(const SplashFontFileID &id)
 --- poppler/splash/SplashFTFontEngine.h.orig	2023-09-05 22:15:14.000000000 +0100
 +++ poppler/splash/SplashFTFontEngine.h	2024-02-21 13:53:29.715423742 +0000
 @@ -27,8 +27,6 @@
@@ -71,23 +71,23 @@
  
      ~SplashFTFontEngine();
  
-@@ -51,22 +49,20 @@
+@@ -49,22 +49,20 @@
      SplashFTFontEngine &operator=(const SplashFTFontEngine &) = delete;
  
      // Load fonts.
--    SplashFontFile *loadType1Font(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, const char **enc, int faceIndex);
--    SplashFontFile *loadType1CFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, const char **enc, int faceIndex);
--    SplashFontFile *loadOpenTypeT1CFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, const char **enc, int faceIndex);
--    SplashFontFile *loadCIDFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, int faceIndex);
--    SplashFontFile *loadOpenTypeCFFFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, std::vector<int> &&codeToGID, int faceIndex);
--    SplashFontFile *loadTrueTypeFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, std::vector<int> &&codeToGID, int faceIndex);
-+    SplashFontFile *loadType1Font(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, const char **enc, int faceIndex) { return nullptr; };
-+    SplashFontFile *loadType1CFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, const char **enc, int faceIndex) { return nullptr; };
-+    SplashFontFile *loadOpenTypeT1CFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, const char **enc, int faceIndex) { return nullptr; };
-+    SplashFontFile *loadCIDFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, int faceIndex) { return nullptr; };
-+    SplashFontFile *loadOpenTypeCFFFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, std::vector<int> &&codeToGID, int faceIndex) { return nullptr; };
-+    SplashFontFile *loadTrueTypeFont(std::unique_ptr<SplashFontFileID> idA, SplashFontSrc *src, std::vector<int> &&codeToGID, int faceIndex) { return nullptr; };
-     bool getAA() { return aa; }
+-    std::shared_ptr<SplashFontFile> loadType1Font(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const char **enc, int faceIndex);
+-    std::shared_ptr<SplashFontFile> loadType1CFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const char **enc, int faceIndex);
+-    std::shared_ptr<SplashFontFile> loadOpenTypeT1CFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const char **enc, int faceIndex);
+-    std::shared_ptr<SplashFontFile> loadCIDFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, int faceIndex);
+-    std::shared_ptr<SplashFontFile> loadOpenTypeCFFFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, std::vector<int> &&codeToGID, int faceIndex);
+-    std::shared_ptr<SplashFontFile> loadTrueTypeFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, std::vector<int> &&codeToGID, int faceIndex);
++    std::shared_ptr<SplashFontFile> loadType1Font(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const char **enc, int faceIndex) { return nullptr; };
++    std::shared_ptr<SplashFontFile> loadType1CFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const char **enc, int faceIndex) { return nullptr; };
++    std::shared_ptr<SplashFontFile> loadOpenTypeT1CFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, const char **enc, int faceIndex) { return nullptr; };
++    std::shared_ptr<SplashFontFile> loadCIDFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, int faceIndex) { return nullptr; };
++    std::shared_ptr<SplashFontFile> loadOpenTypeCFFFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, std::vector<int> &&codeToGID, int faceIndex) { return nullptr; };
++    std::shared_ptr<SplashFontFile> loadTrueTypeFont(std::unique_ptr<SplashFontFileID> idA, std::unique_ptr<SplashFontSrc> src, std::vector<int> &&codeToGID, int faceIndex) { return nullptr; };
+     bool getAA() const { return aa; }
      void setAA(bool aaA) { aa = aaA; }
  
  private:
diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1
index edf04d4..53685b1 100644
--- libreoffice-26.2.1.1/external/poppler/poppler-config.patch.1
+++ libreoffice-26.2.1.1/external/poppler/poppler-config.patch.1
@@ -120,7 +120,7 @@
 +#define PACKAGE_NAME "poppler"
 +
 +/* Define to the full name and version of this package. */
-+#define PACKAGE_STRING "poppler 26.01.0"
++#define PACKAGE_STRING "poppler 26.02.0"
 +
 +/* Define to the one symbol short name of this package. */
 +#define PACKAGE_TARNAME "poppler"
@@ -129,7 +129,7 @@
 +#define PACKAGE_URL ""
 +
 +/* Define to the version of this package. */
-+#define PACKAGE_VERSION "26.01.0"
++#define PACKAGE_VERSION "26.02.0"
 +
 +/* Poppler data dir */
 +#define POPPLER_DATADIR "/usr/local/share/poppler"
@@ -144,7 +144,7 @@
 +#define USE_FLOAT 0
 +
 +/* Version number of package */
-+#define VERSION "26.01.0"
++#define VERSION "26.02.0"
 +
 +#if defined(__APPLE__)
 +#elif defined (_WIN32)
@@ -222,7 +222,7 @@
 +#define POPPLER_CONFIG_H
 +
 +/* Defines the poppler version. */
-+#define POPPLER_VERSION "26.01.0"
++#define POPPLER_VERSION "26.02.0"
 +
 +/* Use single precision arithmetic in the Splash backend */
 +#define USE_FLOAT 0
@@ -310,9 +310,9 @@
 +
 +#include "poppler-global.h"
 +
-+#define POPPLER_VERSION "26.01.0"
++#define POPPLER_VERSION "26.02.0"
 +#define POPPLER_VERSION_MAJOR 26
-+#define POPPLER_VERSION_MINOR 01
++#define POPPLER_VERSION_MINOR 02
 +#define POPPLER_VERSION_MICRO 0
 +
 +namespace poppler
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 6b91848..f1487453 100644
--- libreoffice-26.2.1.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ libreoffice-26.2.1.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -711,13 +711,17 @@
     printf( "restoreState\n" );
 }
 
-#if POPPLER_CHECK_VERSION(0, 71, 0)
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+void PDFOutDev::setDefaultCTM(const std::array<double, 6> &pMat)
+#elif POPPLER_CHECK_VERSION(0, 71, 0)
 void PDFOutDev::setDefaultCTM(const double *pMat)
 #else
 void PDFOutDev::setDefaultCTM(double *pMat)
 #endif
 {
+#if !POPPLER_CHECK_VERSION(26, 2, 0)
     assert(pMat);
+#endif
 
     OutputDev::setDefaultCTM(pMat);
 
@@ -737,8 +741,12 @@
 {
     assert(state);
 
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+    const std::array<double, 6> pMat = state->getCTM();
+#else
     const double* const pMat = state->getCTM();
     assert(pMat);
+#endif
 
     printf( "updateCtm %f %f %f %f %f %f\n",
             normalize(pMat[0]),
@@ -1044,7 +1052,11 @@
 
     double csdx = 0.0;
     double csdy = 0.0;
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+    if (!state->getFont() || GfxFont::WritingMode::Horizontal == state->getFont()->getWMode())
+#else
     if (!state->getFont() || !state->getFont()->getWMode())
+#endif
     {
         csdx = state->getCharSpace();
         if (*u == ' ')
@@ -1067,7 +1079,11 @@
     const double aPositionX(x-originX);
     const double aPositionY(y-originY);
 
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+    const std::array<double, 6> pTextMat=state->getTextMat();
+#else
     const double* pTextMat=state->getTextMat();
+#endif
     printf( "drawChar %f %f %f %f %f %f %f %f %f ",
             normalize(aPositionX),
             normalize(aPositionY),
@@ -1348,7 +1364,11 @@
 
     const int nDPI = 72; // GfxState seems to have 72.0 as magic for some reason
     auto pSplashGfxState = new GfxState(nDPI, nDPI, &aBox, 0, false);
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+    auto pSplashOut = new SplashOutputDev(splashModeRGB8, 1, nullptr);
+#else
     auto pSplashOut = new SplashOutputDev(splashModeRGB8, 1, false, nullptr);
+#endif
     pSplashOut->setEnableFreeType(false);
     pSplashOut->startDoc(m_pDoc);
     pSplashOut->startPage(0 /* pageNum */, pSplashGfxState, nullptr /* xref */);
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index b7bd912..da587b1 100644
--- libreoffice-26.2.1.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ libreoffice-26.2.1.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -85,13 +85,21 @@
             isUnderline(rSrc.isUnderline),
             size(rSrc.size)
         {
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+            familyName.append(rSrc.getFamilyName());
+#else
             familyName.append(&rSrc.getFamilyName());
+#endif
         }
 
         FontAttributes& operator=( const FontAttributes& rSrc )
         {
             familyName.clear();
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+            familyName.append(rSrc.getFamilyName());
+#else
             familyName.append(&rSrc.getFamilyName());
+#endif
 
             isEmbedded  = rSrc.isEmbedded;
             maFontWeight= rSrc.maFontWeight;
@@ -104,12 +112,21 @@
 
         bool operator==(const FontAttributes& rFont) const
         {
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+            return getFamilyName().compare(rFont.getFamilyName())==0 &&
+                isEmbedded == rFont.isEmbedded &&
+                maFontWeight == rFont.maFontWeight &&
+                isItalic == rFont.isItalic &&
+                isUnderline == rFont.isUnderline &&
+                size == rFont.size;
+#else
             return getFamilyName().cmp(&rFont.getFamilyName())==0 &&
                 isEmbedded == rFont.isEmbedded &&
                 maFontWeight == rFont.maFontWeight &&
                 isItalic == rFont.isItalic &&
                 isUnderline == rFont.isUnderline &&
                 size == rFont.size;
+#endif
         }
 
         GooString   familyName;
@@ -172,7 +189,9 @@
         //----- initialization and control
 
         // Set default transform matrix.
-#if POPPLER_CHECK_VERSION(0, 71, 0)
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+void setDefaultCTM(const std::array<double, 6> &pMat) override;
+#elif POPPLER_CHECK_VERSION(0, 71, 0)
         virtual void setDefaultCTM(const double *ctm) override;
 #else
         virtual void setDefaultCTM(double *ctm) override;
