From 98828255aa0c1212329236b3ff4ac7f41efb4a67 Mon Sep 17 00:00:00 2001
From: Varasina Farmadani <sina@sinanonym.my.id>
Date: Mon, 11 May 2026 02:29:05 +0700
Subject: [PATCH] fix: support for popler >= 26.05 font encoding change

Poppler version 26.05.0 changed the return type of
gfx8bit->getEncoding() from char** to const std::array<const char*,256>&.
this caused a compilation error due to type incompatibility:
    error: assigning to 'char **' from incompatible type 'const std::array<const char *, 256>
    error: no viable conversion from 'const std::array<const char *, 256>' to 'char **'
---
 .../pdfinput/poppler-cairo-font-engine.cpp         | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
+++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
@@ -313,7 +313,11 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
 #else
     GfxFontLoc *fontLoc;
 #endif
+#if POPPLER_CHECK_VERSION(26, 5, 0)
+    const char * const *enc;
+#else
     char **enc;
+#endif
     const char *name;
 #if POPPLER_CHECK_VERSION(25, 7, 0)
     std::unique_ptr<FoFiType1C> ff1c;
@@ -385,7 +389,11 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
                 goto err2;
             }
 
+#if POPPLER_CHECK_VERSION(26, 5, 0)
+            enc = gfx8bit->getEncoding().data();
+#else
             enc = gfx8bit->getEncoding();
+#endif
 
             codeToGID.resize(256);
             for (i = 0; i < 256; ++i) {
@@ -677,7 +685,7 @@ CairoType3Font *CairoType3Font::create(G
 #endif
 
     std::vector<int> codeToGID;
-    char *name;
+    const char *name;
 
     Dict *charProcs = gfx8bit->getCharProcs();
     Ref ref = *gfxFont->getID();
@@ -694,7 +702,11 @@ CairoType3Font *CairoType3Font::create(G
 
     cairo_font_face_set_user_data(font_face, &type3_font_key, (void *)info, _free_type3_font_info);
 
+#if POPPLER_CHECK_VERSION(26, 5, 0)
+    const char * const *enc = gfx8bit->getEncoding().data();
+#else
     char **enc = gfx8bit->getEncoding();
+#endif
     codeToGID.resize(256);
     for (int i = 0; i < 256; ++i) {
         codeToGID[i] = 0;
