From b08afae7e41fd5ca3a4101de07366783b17b3887 Mon Sep 17 00:00:00 2001
From: Xisco Fauli <xiscofauli@libreoffice.org>
Date: Wed, 3 Jun 2026 17:37:11 +0200
Subject: [PATCH] poppler: upgrade to 26.06

Downloaded from https://poppler.freedesktop.org/poppler-26.06.0.tar.xz

Change-Id: Idbcf3baf344f7400dad28d06e4a2b18118e647f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205964
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
---
 download.lst                                  |  4 ++--
 external/poppler/disable-freetype.patch.1     |  4 ++--
 external/poppler/poppler-config.patch.1       | 12 +++++------
 .../pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx  | 20 +++++++++++++++++--
 4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/download.lst b/download.lst
index 754ea432b3706..133fff9f415b6 100644
--- a/download.lst
+++ b/download.lst
@@ -599,8 +599,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-POPPLER_SHA256SUM := 6fef27ff04f37db43054c86bcdff6128c9fb1f6af4ef3c8b369a7e9abd68d0bb
-POPPLER_TARBALL := poppler-26.05.0.tar.xz
+POPPLER_SHA256SUM := 4cb4e5a3dc8cb5eec751c8a23c8ba19f61f96dedc0cd07d2aee6b0c8e2cf6ba4
+POPPLER_TARBALL := poppler-26.06.0.tar.xz
 POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74
 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz
 # three static lines
diff --git a/external/poppler/disable-freetype.patch.1 b/external/poppler/disable-freetype.patch.1
index ea0d37ea24de4..26c9ca84c355f 100644
--- a/external/poppler/disable-freetype.patch.1
+++ b/external/poppler/disable-freetype.patch.1
@@ -23,14 +23,14 @@ disable freetype dependent code
  #include <unordered_set>
  
  // helper for using std::visit to get a dependent false for static_asserts
-@@ -2723,6 +2723,8 @@
+@@ -2738,6 +2738,8 @@
  
  Form::AddFontResult Form::addFontToDefaultResources(const std::string &filepath, int faceIndex, const std::string &fontFamily, const std::string &fontStyle, bool fontSubstitutedIn, bool forceName)
  {
 +    return {};
 +#if 0
      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());
+         error(errIO, -1, "We only support embedding ttf/ttc/otf fonts for now. The font file for {0:r} {1:r} was {2:r}", &fontFamily, &fontStyle, &filepath);
          return {};
 @@ -2974,6 +2974,7 @@
      }
diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1
index 3a1f2c1eb6ba8..b6ace1d64f081 100644
--- a/external/poppler/poppler-config.patch.1
+++ b/external/poppler/poppler-config.patch.1
@@ -120,7 +120,7 @@ index 0fbd336a..451213f8 100644
 +#define PACKAGE_NAME "poppler"
 +
 +/* Define to the full name and version of this package. */
-+#define PACKAGE_STRING "poppler 26.04.0"
++#define PACKAGE_STRING "poppler 26.06.0"
 +
 +/* Define to the one symbol short name of this package. */
 +#define PACKAGE_TARNAME "poppler"
@@ -129,7 +129,7 @@ index 0fbd336a..451213f8 100644
 +#define PACKAGE_URL ""
 +
 +/* Define to the version of this package. */
-+#define PACKAGE_VERSION "26.04.0"
++#define PACKAGE_VERSION "26.06.0"
 +
 +/* Poppler data dir */
 +#define POPPLER_DATADIR "/usr/local/share/poppler"
@@ -144,7 +144,7 @@ index 0fbd336a..451213f8 100644
 +#define USE_FLOAT 0
 +
 +/* Version number of package */
-+#define VERSION "26.04.0"
++#define VERSION "26.06.0"
 +
 +#if defined(__APPLE__)
 +#elif defined (_WIN32)
@@ -222,7 +222,7 @@ index 0fbd336a..451213f8 100644
 +#define POPPLER_CONFIG_H
 +
 +/* Defines the poppler version. */
-+#define POPPLER_VERSION "26.04.0"
++#define POPPLER_VERSION "26.06.0"
 +
 +/* Use single precision arithmetic in the Splash backend */
 +#define USE_FLOAT 0
@@ -310,9 +310,9 @@ index 0fbd336a..451213f8 100644
 +
 +#include "poppler-global.h"
 +
-+#define POPPLER_VERSION "26.04.0"
++#define POPPLER_VERSION "26.06.0"
 +#define POPPLER_VERSION_MAJOR 26
-+#define POPPLER_VERSION_MINOR 04
++#define POPPLER_VERSION_MINOR 06
 +#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 18c855908f024..ed91b55533349 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -60,6 +60,10 @@
 #include "UTF8.h"
 #endif
 
+#if POPPLER_CHECK_VERSION(26, 6, 0)
+#include <Annot.h>
+#endif
+
 #ifdef _WIN32
 # define snprintf _snprintf
 
@@ -1223,7 +1227,9 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
         {
             GfxRGB aMinRGB;
             colorMap->getColorSpace()->getRGB(
-#if POPPLER_CHECK_VERSION(0, 82, 0)
+#if POPPLER_CHECK_VERSION(26, 6, 0)
+                *reinterpret_cast<const GfxColor*>(maskColors),
+#elif POPPLER_CHECK_VERSION(0, 82, 0)
                 reinterpret_cast<const GfxColor*>(maskColors),
 #else
                 reinterpret_cast<GfxColor*>(maskColors),
@@ -1232,7 +1238,9 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
 
             GfxRGB aMaxRGB;
             colorMap->getColorSpace()->getRGB(
-#if POPPLER_CHECK_VERSION(0, 82, 0)
+#if POPPLER_CHECK_VERSION(26, 6, 0)
+                *(reinterpret_cast<const GfxColor*>(maskColors)+gfxColorMaxComps),
+#elif POPPLER_CHECK_VERSION(0, 82, 0)
                 reinterpret_cast<const GfxColor*>(maskColors)+gfxColorMaxComps,
 #else
                 reinterpret_cast<GfxColor*>(maskColors)+gfxColorMaxComps,
@@ -1365,7 +1373,11 @@ poppler_bool PDFOutDev::tilingPatternFill(GfxState *state, Gfx *, Catalog *,
     aBox.y2 = pBbox[3];
 
     const int nDPI = 72; // GfxState seems to have 72.0 as magic for some reason
+#if POPPLER_CHECK_VERSION(26, 6, 0)
+    auto pSplashGfxState = new GfxState(nDPI, nDPI, aBox, 0, false);
+#else
     auto pSplashGfxState = new GfxState(nDPI, nDPI, &aBox, 0, false);
+#endif
 #if POPPLER_CHECK_VERSION(26, 2, 0)
     auto pSplashOut = new SplashOutputDev(splashModeRGB8, 1, nullptr);
 #else
@@ -1375,7 +1387,11 @@ poppler_bool PDFOutDev::tilingPatternFill(GfxState *state, Gfx *, Catalog *,
     pSplashOut->startDoc(m_pDoc);
     pSplashOut->startPage(0 /* pageNum */, pSplashGfxState, nullptr /* xref */);
 
+#if POPPLER_CHECK_VERSION(26, 6, 0)
+    auto pSplashGfx = new Gfx(m_pDoc, pSplashOut, pResDict, aBox, nullptr);
+#else
     auto pSplashGfx = new Gfx(m_pDoc, pSplashOut, pResDict, &aBox, nullptr);
+#endif
     pSplashGfx->display(aStr);
     std::unique_ptr<SplashBitmap> pSplashBitmap(pSplashOut->takeBitmap());
     // Poppler tells us to free the splash device immediately after taking the
