commit: fa8079a0b3e15b85f4f4bd0034aadbbf6a167d55 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> AuthorDate: Sat Feb 15 00:10:26 2025 +0000 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> CommitDate: Sat Feb 15 00:11:16 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa8079a0
media-gfx/inkscape: fix build with poppler-25.02.0 Closes: https://bugs.gentoo.org/949531 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> .../files/inkscape-1.4-poppler-25.02.0.patch | 179 +++++++++++++++++++++ media-gfx/inkscape/inkscape-1.4-r1.ebuild | 1 + 2 files changed, 180 insertions(+) diff --git a/media-gfx/inkscape/files/inkscape-1.4-poppler-25.02.0.patch b/media-gfx/inkscape/files/inkscape-1.4-poppler-25.02.0.patch new file mode 100644 index 000000000000..21f41e1b155c --- /dev/null +++ b/media-gfx/inkscape/files/inkscape-1.4-poppler-25.02.0.patch @@ -0,0 +1,179 @@ +From 5c4c6d116dae5250d75d34a45f0d9220824d2e20 Mon Sep 17 00:00:00 2001 +From: KrIr17 <[email protected]> +Date: Sun, 9 Feb 2025 22:52:53 +0530 +Subject: [PATCH] Fix building with poppler 25.02.0 + +1. `getCodeToGIDMap`, `getCIDToGID`, `getCIDToGIDMap` are now `std::vector` + +2. `pdfDocEncodingToUTF16` returns an `std::string` +--- + .../pdfinput/poppler-cairo-font-engine.cpp | 50 +++++++++++++++---- + .../pdfinput/poppler-transition-api.h | 20 +++++--- + 3 files changed, 63 insertions(+), 16 deletions(-) + +diff --git a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp +index 728b1d1aac4..bd1d4e49367 100644 +--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp ++++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp +@@ -405,14 +405,22 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li + break; + case fontCIDType2: + case fontCIDType2OT: ++#if POPPLER_CHECK_VERSION(25,2,0) ++ if (!gfxcid->getCIDToGID().empty()) { ++ const auto src = gfxcid->getCIDToGID(); ++ codeToGID = std::move(src); ++ } ++#else + if (gfxcid->getCIDToGID()) { + n = gfxcid->getCIDToGIDLen(); + if (n) { +- const int *src = gfxcid->getCIDToGID(); ++ const auto src = gfxcid->getCIDToGID(); + codeToGID.reserve(n); + codeToGID.insert(codeToGID.begin(), src, src + n); + } +- } else { ++ } ++#endif ++ else { + #if POPPLER_CHECK_VERSION(22, 1, 0) + std::unique_ptr<FoFiTrueType> ff; + #else +@@ -427,13 +435,18 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li + goto err2; + } + #if POPPLER_CHECK_VERSION(22, 1, 0) +- int *src = gfxcid->getCodeToGIDMap(ff.get(), &n); ++ auto src = gfxcid->_POPPLER_GET_CODE_TO_GID_MAP(ff.get(), &n); + #else +- int *src = gfxcid->getCodeToGIDMap(ff, &n); ++ auto src = gfxcid->_POPPLER_GET_CODE_TO_GID_MAP(ff, &n); + #endif ++ ++#if POPPLER_CHECK_VERSION(25,2,0) ++ codeToGID = std::move(src); ++#else + codeToGID.reserve(n); + codeToGID.insert(codeToGID.begin(), src, src + n); + gfree(src); ++#endif + } + /* Fall through */ + case fontTrueType: +@@ -455,13 +468,17 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li + /* This might be set already for the CIDType2 case */ + if (fontType == fontTrueType || fontType == fontTrueTypeOT) { + #if POPPLER_CHECK_VERSION(22, 1, 0) +- int *src = gfx8bit->getCodeToGIDMap(ff.get()); ++ auto src = gfx8bit->getCodeToGIDMap(ff.get()); + #else +- int *src = gfx8bit->getCodeToGIDMap(ff); ++ auto src = gfx8bit->getCodeToGIDMap(ff); + #endif ++#if POPPLER_CHECK_VERSION(25,2,0) ++ codeToGID = std::move(src); ++#else + codeToGID.reserve(256); + codeToGID.insert(codeToGID.begin(), src, src + 256); + gfree(src); ++#endif + } + font_face = getFreeTypeFontFace(fontEngine, lib, fileName, std::move(font_data)); + if (!font_face) { +@@ -479,10 +496,14 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li + ff1c = FoFiType1C::load(fileName.c_str()); + } + if (ff1c) { +- int *src = ff1c->getCIDToGIDMap(&n); ++ auto src = ff1c->_POPPLER_GET_CID_TO_GID_MAP(&n); ++#if POPPLER_CHECK_VERSION(25,2,0) ++ codeToGID = std::move(src); ++#else + codeToGID.reserve(n); + codeToGID.insert(codeToGID.begin(), src, src + n); + gfree(src); ++#endif + delete ff1c; + } + } +@@ -495,14 +516,21 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li + break; + + case fontCIDType0COT: ++#if POPPLER_CHECK_VERSION(25,2,0) ++ if (!gfxcid->getCIDToGID().empty()) { ++ const auto src = gfxcid->getCIDToGID(); ++ codeToGID = std::move(src); ++ } ++#else + if (gfxcid->getCIDToGID()) { + n = gfxcid->getCIDToGIDLen(); + if (n) { +- const int *src = gfxcid->getCIDToGID(); ++ const auto src = gfxcid->getCIDToGID(); + codeToGID.reserve(n); + codeToGID.insert(codeToGID.begin(), src, src + n); + } + } ++#endif + + if (codeToGID.empty()) { + if (!useCIDs) { +@@ -518,10 +546,14 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li + } + if (ff) { + if (ff->isOpenTypeCFF()) { +- int *src = ff->getCIDToGIDMap(&n); ++ auto src = ff1c->_POPPLER_GET_CID_TO_GID_MAP(&n); ++#if POPPLER_CHECK_VERSION(25,2,0) ++ codeToGID = std::move(src); ++#else + codeToGID.reserve(n); + codeToGID.insert(codeToGID.begin(), src, src + n); + gfree(src); ++#endif + } + } + } +diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h +index b7a54828e74..a67132ba6bd 100644 +--- a/src/extension/internal/pdfinput/poppler-transition-api.h ++++ b/src/extension/internal/pdfinput/poppler-transition-api.h +@@ -15,6 +15,20 @@ + #include <glib/poppler-features.h> + #include <poppler/UTF.h> + ++#if POPPLER_CHECK_VERSION(25,2,0) ++#define _POPPLER_GET_CODE_TO_GID_MAP(ff, len) getCodeToGIDMap(ff) ++#define _POPPLER_GET_CID_TO_GID_MAP(len) getCIDToGIDMap() ++#else ++#define _POPPLER_GET_CODE_TO_GID_MAP(ff, len) getCodeToGIDMap(ff, len) ++#define _POPPLER_GET_CID_TO_GID_MAP(len) getCIDToGIDMap(len) ++#endif ++ ++#if POPPLER_CHECK_VERSION(24,12,0) ++#define _POPPLER_GET_IMAGE_PARAMS(bits, csMode, hasAlpha) getImageParams(bits, csMode, hasAlpha) ++#else ++#define _POPPLER_GET_IMAGE_PARAMS(bits, csMode, hasAlpha) getImageParams(bits, csMode) ++#endif ++ + #if POPPLER_CHECK_VERSION(24, 10, 0) + #define _POPPLER_CONSUME_UNIQPTR_ARG(value) std::move(value) + #else +@@ -39,12 +53,6 @@ + #define _POPPLER_FUNCTION_TYPE_STITCHING 3 + #endif + +-#if POPPLER_CHECK_VERSION(24,12,0) +-#define _POPPLER_GET_IMAGE_PARAMS(bits, csMode, hasAlpha) getImageParams(bits, csMode, hasAlpha) +-#else +-#define _POPPLER_GET_IMAGE_PARAMS(bits, csMode, hasAlpha) getImageParams(bits, csMode) +-#endif +- + #if POPPLER_CHECK_VERSION(22, 4, 0) + #define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr.get()) + #else +-- +GitLab + diff --git a/media-gfx/inkscape/inkscape-1.4-r1.ebuild b/media-gfx/inkscape/inkscape-1.4-r1.ebuild index 574250c2b239..5991d288758d 100644 --- a/media-gfx/inkscape/inkscape-1.4-r1.ebuild +++ b/media-gfx/inkscape/inkscape-1.4-r1.ebuild @@ -117,6 +117,7 @@ PATCHES=( "${FILESDIR}"/${PN}-1.4-poppler-24.10-fix-backport.patch "${FILESDIR}"/${P}-poppler-24.11.0.patch # bug 943499 "${FILESDIR}"/${P}-poppler-24.12.0.patch # bug 946597 + "${FILESDIR}"/${P}-poppler-25.02.0.patch # bug 949531 ) pkg_pretend() {
