commit: 1bedb87c4c63e6156a42c14364fcba4d65e23221 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Fri Feb 13 19:46:28 2026 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Sat Feb 14 11:55:47 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bedb87c
media-gfx/inkscape: Fix build w/ poppler-26.02 See also: https://gitlab.com/inkscape/inkscape/-/issues/6054 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> .../inkscape-1.4.3-poppler-26.01-warnings.patch | 55 ++++++ .../files/inkscape-1.4.3-poppler-26.01.patch | 23 +-- .../files/inkscape-1.4.3-poppler-26.02.patch | 214 +++++++++++++++++++++ media-gfx/inkscape/inkscape-1.4.3-r1.ebuild | 2 +- 4 files changed, 282 insertions(+), 12 deletions(-) diff --git a/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01-warnings.patch b/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01-warnings.patch new file mode 100644 index 000000000000..0ab9c2255902 --- /dev/null +++ b/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01-warnings.patch @@ -0,0 +1,55 @@ +From 5d4310dd8a0e4ca83850789a083710f82fb4d9b3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ji=C5=99=C3=AD=20Faist?= <[email protected]> +Date: Mon, 2 Feb 2026 17:39:08 +0100 +Subject: [PATCH 2/3] Fix warning with poppler 26.x.x + +(cherry picked from commit ada064ea37f37a92bb1846a048a3da2c2185d3b2) +--- + .../internal/pdfinput/svg-builder.cpp | 24 +++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp +index 8b2e6f3d54..94d4342dc4 100644 +--- a/src/extension/internal/pdfinput/svg-builder.cpp ++++ b/src/extension/internal/pdfinput/svg-builder.cpp +@@ -2095,7 +2095,17 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height + image_stream = new ImageStream(str, width, 1, 1); + } + #if POPPLER_CHECK_VERSION(26, 0, 0) +- image_stream->rewind(); ++ if(!image_stream->rewind()) ++ { ++ g_warning("ImageStream: Failed to rewind image stream"); ++ png_destroy_write_struct(&png_ptr, &info_ptr); ++ if (!_embed_images) { ++ fclose(fp); ++ g_free(file_name); ++ } ++ delete image_stream; ++ return nullptr; ++ } + #else + image_stream->reset(); + #endif +@@ -2125,7 +2135,17 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height + color_map->getNumPixelComps(), + color_map->getBits()); + #if POPPLER_CHECK_VERSION(26, 0, 0) +- image_stream->rewind(); ++ if(!image_stream->rewind()) ++ { ++ g_warning("ImageStream: Failed to rewind image stream"); ++ png_destroy_write_struct(&png_ptr, &info_ptr); ++ if (!_embed_images) { ++ fclose(fp); ++ g_free(file_name); ++ } ++ delete image_stream; ++ return nullptr; ++ } + #else + image_stream->reset(); + #endif +-- +2.53.0 + diff --git a/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01.patch b/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01.patch index c74de91c7c91..8c73d3c9b83a 100644 --- a/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01.patch +++ b/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.01.patch @@ -1,18 +1,19 @@ -From 3a528728ebe33e10bb44d152f47cfedfddbfe18a Mon Sep 17 00:00:00 2001 +From b7254b3501a898c892211e6b363a292ba01dec08 Mon Sep 17 00:00:00 2001 From: Thomas Holder <[email protected]> Date: Sat, 10 Jan 2026 23:44:10 +0100 -Subject: [PATCH] Fix build with poppler 26.01.0 +Subject: [PATCH 1/3] Fix build with poppler 26.01.0 +(cherry picked from commit 3a528728ebe33e10bb44d152f47cfedfddbfe18a) --- src/extension/internal/pdfinput/pdf-input.cpp | 1 + src/extension/internal/pdfinput/svg-builder.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp -index 89d90ff0fe..bba8633e18 100644 +index 7b5e0ecb1d..45df931f00 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp -@@ -32,6 +32,7 @@ +@@ -33,6 +33,7 @@ #include <poppler/glib/poppler.h> #include <poppler/glib/poppler-document.h> #include <poppler/glib/poppler-page.h> @@ -21,18 +22,18 @@ index 89d90ff0fe..bba8633e18 100644 #include <gdkmm/general.h> diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp -index 1b15b425b1..e1de266111 100644 +index 6c78247dfb..8b2e6f3d54 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp -@@ -29,6 +29,7 @@ +@@ -32,6 +32,7 @@ #include <poppler/GfxState.h> #include <poppler/Page.h> #include <poppler/Stream.h> +#include <poppler/goo/gmem.h> - #ifdef _WIN32 - #undef near -@@ -2145,7 +2146,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height + #include "color.h" + #include "color/cms-util.h" +@@ -2093,7 +2094,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height } else { image_stream = new ImageStream(str, width, 1, 1); } @@ -44,7 +45,7 @@ index 1b15b425b1..e1de266111 100644 // Convert grayscale values unsigned char *buffer = new unsigned char[width]; -@@ -2171,7 +2176,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height +@@ -2119,7 +2124,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height image_stream = new ImageStream(str, width, color_map->getNumPixelComps(), color_map->getBits()); @@ -57,5 +58,5 @@ index 1b15b425b1..e1de266111 100644 // Convert RGB values unsigned int *buffer = new unsigned int[width]; -- -GitLab +2.53.0 diff --git a/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.02.patch b/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.02.patch new file mode 100644 index 000000000000..e2f9e04a686d --- /dev/null +++ b/media-gfx/inkscape/files/inkscape-1.4.3-poppler-26.02.patch @@ -0,0 +1,214 @@ +Source: https://gitlab.com/inkscape/inkscape/-/merge_requests/7780 + +From cbd48e53d20af4ff8071028ccc6db9bc188e6548 Mon Sep 17 00:00:00 2001 +From: KrIr17 <[email protected]> +Date: Thu, 12 Feb 2026 20:58:50 +0100 +Subject: [PATCH 3/3] Fix building with Poppler 0.26.02 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Adapted from [1] with changes to make it backwards-compatible with older +versions of Poppler. + +[1] github.com/OpenMandrivaAssociation/inkscape/blob/master/inkscape-poppler-26.02.patch#L29 + +Credits: Bernhard Rosenkränzer <[email protected]> + +Fixes https://gitlab.com/inkscape/inkscape/-/issues/6054 + +* asturm 2026-02-14: backported to 1.4.x branch +--- + .../internal/pdfinput/pdf-parser.cpp | 39 +++++++++++++++++-- + .../pdfinput/poppler-transition-api.h | 10 +++++ + .../internal/pdfinput/svg-builder.cpp | 10 ++--- + 3 files changed, 50 insertions(+), 9 deletions(-) + +diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp +index ba6c448513..cb0842757d 100644 +--- a/src/extension/internal/pdfinput/pdf-parser.cpp ++++ b/src/extension/internal/pdfinput/pdf-parser.cpp +@@ -653,7 +653,11 @@ void PdfParser::opSetFlat(Object args[], int /*numArgs*/) + void PdfParser::opSetLineJoin(Object args[], int /*numArgs*/) + { + builder->beforeStateChange(state); ++#if POPPLER_CHECK_VERSION(26,2,0) ++ state->setLineJoin((GfxState::LineJoinStyle) args[0].getInt()); ++#else + state->setLineJoin(args[0].getInt()); ++#endif + builder->updateStyle(state); + } + +@@ -661,7 +665,11 @@ void PdfParser::opSetLineJoin(Object args[], int /*numArgs*/) + void PdfParser::opSetLineCap(Object args[], int /*numArgs*/) + { + builder->beforeStateChange(state); ++#if POPPLER_CHECK_VERSION(26,2,0) ++ state->setLineCap((GfxState::LineCapStyle) args[0].getInt()); ++#else + state->setLineCap(args[0].getInt()); ++#endif + builder->updateStyle(state); + } + +@@ -1565,7 +1573,13 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat, + + // restore graphics state + restoreState(); ++#if POPPLER_CHECK_VERSION(26, 2, 0) ++ state->clearPath(); ++ GfxPath *currPath = const_cast<GfxPath*>(state->getPath()); ++ currPath->append(savedPath); ++#else + state->setPath(savedPath); ++#endif + } + + // TODO not good that numArgs is ignored but args[] is used: +@@ -1626,7 +1640,13 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) + // restore graphics state + if (savedState) { + restoreState(); ++#if POPPLER_CHECK_VERSION(26, 2, 0) ++ state->clearPath(); ++ GfxPath *currPath = const_cast<GfxPath*>(state->getPath()); ++ currPath->append(savedPath); ++#else + state->setPath(savedPath); ++#endif + } + } + +@@ -2213,7 +2233,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) + { + Array *a = nullptr; + Object obj; +- int wMode = 0; // Writing mode (horizontal/vertical). ++ _POPPLER_WMODE wMode = _POPPLER_WMODE_HORIZONTAL; // Writing mode (horizontal/vertical). + + if (!state->getFont()) { + error(errSyntaxError, getPos(), "No font in show/space"); +@@ -2227,7 +2247,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) + if (obj.isNum()) { + // this uses the absolute value of the font size to match + // Acrobat's behavior +- if (wMode) { ++ if (wMode != _POPPLER_WMODE_HORIZONTAL) { + state->textShift(0, -obj.getNum() * 0.001 * + fabs(state->getFontSize())); + } else { +@@ -2254,7 +2274,7 @@ void PdfParser::doShowText(const GooString *s) { + void PdfParser::doShowText(GooString *s) { + #endif + auto font = state->getFont(); +- int wMode = font->getWMode(); // Vertical/Horizontal/Invalid ++ _POPPLER_WMODE wMode = font->getWMode(); // Vertical/Horizontal/Invalid + + builder->beginString(state, get_goostring_length(*s)); + +@@ -2289,7 +2309,7 @@ void PdfParser::doShowText(GooString *s) { + auto ax = dx; + auto ay = dy; + +- if (wMode != 0) { ++ if (wMode != _POPPLER_WMODE_HORIZONTAL) { + // Vertical text (or invalid value). + dy += state->getCharSpace(); + if (n == 1 && *p == ' ') { +@@ -2964,7 +2984,11 @@ Stream *PdfParser::buildImageStream() { + // make stream + #if defined(POPPLER_NEW_OBJECT_API) + str = new EmbedStream(parser->getStream(), dict.copy(), gFalse, 0); ++#if POPPLER_CHECK_VERSION(26, 2, 0) ++ str = str->addFilters(std::unique_ptr<Stream>(str), dict.getDict()).release(); ++#else + str = str->addFilters(dict.getDict()); ++#endif + #else + str = new EmbedStream(parser->getStream(), &dict, gFalse, 0); + str = str->addFilters(&dict); +@@ -3137,10 +3161,17 @@ void PdfParser::loadOptionalContentLayers(Dict *resources) + auto visible = true; + // Normally we'd use poppler optContentIsVisible, but these dict + // objects don't retain their references so can't be used directly. ++#if POPPLER_CHECK_VERSION(26, 2, 0) ++ for (auto &[ref, ocg] : ocgs->getOCGs()) { ++ if (ocg->getName()->toStr() == label) ++ visible = ocg->getState() == OptionalContentGroup::On; ++ } ++#else + for (auto &[ref, ocg] : ocgs->getOCGs()) { + if (ocg->getName()->cmp(label) == 0) + visible = ocg->getState() == OptionalContentGroup::On; + } ++#endif + builder->addOptionalGroup(dict->getKey(j), label, visible); + } + } +diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h +index 866b630bb6..65788128b7 100644 +--- a/src/extension/internal/pdfinput/poppler-transition-api.h ++++ b/src/extension/internal/pdfinput/poppler-transition-api.h +@@ -15,6 +15,16 @@ + #include <glib/poppler-features.h> + #include <poppler/UTF.h> + ++#if POPPLER_CHECK_VERSION(26, 2, 0) ++#define _POPPLER_WMODE GfxFont::WritingMode ++#define _POPPLER_WMODE_HORIZONTAL GfxFont::WritingMode::Horizontal ++#define _POPPLER_WMODE_VERTICAL GfxFont::WritingMode::Vertical ++#else ++#define _POPPLER_WMODE int ++#define _POPPLER_WMODE_HORIZONTAL 0 ++#define _POPPLER_WMODE_VERTICAL 1 ++#endif ++ + #if POPPLER_CHECK_VERSION(25, 7, 0) + #define _POPPLER_TEXT_SHIFT_WITH_USER_COORDS(dx, dy) textShiftWithUserCoords(dx, dy) + #define _POPPLER_FOFI_TRUETYPE_MAKE(font_data, faceIndex) FoFiTrueType::make(std::span(font_data), faceIndex) +diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp +index 94d4342dc4..d854ed8a2e 100644 +--- a/src/extension/internal/pdfinput/svg-builder.cpp ++++ b/src/extension/internal/pdfinput/svg-builder.cpp +@@ -1386,7 +1386,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shared_ptr<CairoFont> cairo_fo + sp_repr_css_set_property(_css_font, "font-variant", "normal"); + + // Writing mode +- if ( font->getWMode() == 0 ) { ++ if ( font->getWMode() == _POPPLER_WMODE_HORIZONTAL ) { + sp_repr_css_set_property(_css_font, "writing-mode", "lr"); + } else { + sp_repr_css_set_property(_css_font, "writing-mode", "tb"); +@@ -1398,7 +1398,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shared_ptr<CairoFont> cairo_fo + */ + void SvgBuilder::updateTextShift(GfxState *state, double shift) { + double shift_value = -shift * 0.001 * fabs(state->getFontSize()); +- if (state->getFont()->getWMode()) { ++ if (state->getFont()->getWMode() != _POPPLER_WMODE_HORIZONTAL) { + _text_position[1] += shift_value; + } else { + _text_position[0] += shift_value; +@@ -1452,7 +1452,7 @@ Inkscape::XML::Node* SvgBuilder::_flushTextText(GfxState *state, double text_sca + + // Text direction is a property of the <text> element. + auto font = state->getFont(); +- if (font->getWMode() == 1) { ++ if (font->getWMode() == _POPPLER_WMODE_VERTICAL) { + // Only set if vertical. + auto css_text = sp_repr_css_attr_new(); + sp_repr_css_set_property(css_text, "writing-mode", "tb"); +@@ -1546,8 +1546,8 @@ Inkscape::XML::Node* SvgBuilder::_flushTextText(GfxState *state, double text_sca + bool output_tspan = + next_it == _glyphs.end() || + next_it->style_changed || +- (writing_mode == 0 && std::abs(glyph.text_position[1] - next_it->text_position[1]) > 0.1) || +- (writing_mode == 1 && std::abs(glyph.text_position[0] - next_it->text_position[0]) > 0.1); ++ (writing_mode == _POPPLER_WMODE_HORIZONTAL && std::abs(glyph.text_position[1] - next_it->text_position[1]) > 0.1) || ++ (writing_mode == _POPPLER_WMODE_VERTICAL && std::abs(glyph.text_position[0] - next_it->text_position[0]) > 0.1); + + if (output_tspan) { + +-- +2.53.0 + diff --git a/media-gfx/inkscape/inkscape-1.4.3-r1.ebuild b/media-gfx/inkscape/inkscape-1.4.3-r1.ebuild index c1b2a2783fc9..f4315ab29cbb 100644 --- a/media-gfx/inkscape/inkscape-1.4.3-r1.ebuild +++ b/media-gfx/inkscape/inkscape-1.4.3-r1.ebuild @@ -113,7 +113,7 @@ DEPEND="${COMMON_DEPEND} " PATCHES=( - "${FILESDIR}"/${P}-poppler-26.01.patch # in git master + "${FILESDIR}"/${P}-poppler-26.0{1,1-warnings,2}.patch # in git master, pending MR "${FILESDIR}"/${P}-libcroco-cmake-minreqver-3.12.patch # bug 965915 )
