From 1e98c3da1eec9d608f09132d641f5e817a8bf4b1 Mon Sep 17 00:00:00 2001 From: Varasina Farmadani 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&. this caused a compilation error due to type incompatibility: error: assigning to 'char **' from incompatible type 'const std::array error: no viable conversion from 'const std::array' to 'char **' Commented out the duplicate resize() line - dilfridge@gentoo.org --- .../pdfinput/poppler-cairo-font-engine.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp index a022ce63c8..cb339a3009 100644 --- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp +++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp @@ -314,7 +314,11 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li #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 ff1c; @@ -386,8 +390,13 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li goto err2; } +#if POPPLER_CHECK_VERSION(26, 5, 0) + enc = gfx8bit->getEncoding().data(); +#else enc = gfx8bit->getEncoding(); +#endif + // codeToGID.resize(256); codeToGID.resize(256); for (i = 0; i < 256; ++i) { codeToGID[i] = 0; @@ -678,7 +687,7 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, CairoFontE #endif std::vector codeToGID; - char *name; + const char *name; Dict *charProcs = gfx8bit->getCharProcs(); Ref ref = *gfxFont->getID(); @@ -695,7 +704,11 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, CairoFontE 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; -- GitLab