From: Matthias Kilian Subject: Re: fix graphics/inkscape with new poppler To: rsadowski@openbsd.org Cc: ports@openbsd.org Date: Tue, 16 Sep 2025 22:23:44 +0200 Ping. On Wed, Sep 10, 2025 at 08:16:22PM +0200, Matthias Kilian wrote: > Fix build with poppler-25.09.1. > > ok? > > Ciao, > Kili > > Index: patches/patch-src_extension_internal_pdfinput_pdf-parser_cpp > =================================================================== > RCS file: /cvs/ports/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser_cpp,v > diff -u -p -r1.25 patch-src_extension_internal_pdfinput_pdf-parser_cpp > --- patches/patch-src_extension_internal_pdfinput_pdf-parser_cpp 10 Jul 2025 19:05:29 -0000 1.25 > +++ patches/patch-src_extension_internal_pdfinput_pdf-parser_cpp 9 Sep 2025 21:19:08 -0000 > @@ -1,6 +1,7 @@ > -Fix build with poppler-25.06 and 25.07. > +Fix build with poppler-25.06, 25.07 and 25.09.1. > > -Partially from upstream commit 1fdfb889bba9ee146c8b826e97bc58a88cb1e529. > +Partially from upstream commits 1fdfb889bba9ee146c8b826e97bc58a88cb1e529 > +and b60d81745016b5f20d4c6aec6d073b8a6f3e499c. > > Index: src/extension/internal/pdfinput/pdf-parser.cpp > --- src/extension/internal/pdfinput/pdf-parser.cpp.orig > @@ -79,7 +80,21 @@ Index: src/extension/internal/pdfinput/p > } > } else { > error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); > -@@ -2316,7 +2319,7 @@ void PdfParser::doShowText(GooString *s) { > +@@ -1649,12 +1652,11 @@ void PdfParser::doFunctionShFill1(GfxFunctionShading * > + GfxColor color0M, color1M, colorM0, colorM1, colorMM; > + GfxColor colors2[4]; > + double functionColorDelta = colorDeltas[pdfFunctionShading-1]; > +- const double *matrix; > + double xM, yM; > + int nComps, i, j; > + > + nComps = shading->getColorSpace()->getNComps(); > +- matrix = shading->getMatrix(); > ++ const auto& matrix = shading->getMatrix(); > + > + // compare the four corner colors > + for (i = 0; i < 4; ++i) { > +@@ -2316,7 +2318,7 @@ void PdfParser::doShowText(GooString *s) { > dx, dy, ax, ay, tOriginX, tOriginY, code, n, u, uLen); > > // Move onto next unicode character. > Index: patches/patch-src_extension_internal_pdfinput_poppler-cairo-font-engine_cpp > =================================================================== > RCS file: /cvs/ports/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_poppler-cairo-font-engine_cpp,v > diff -u -p -r1.4 patch-src_extension_internal_pdfinput_poppler-cairo-font-engine_cpp > --- patches/patch-src_extension_internal_pdfinput_poppler-cairo-font-engine_cpp 10 Jul 2025 19:05:29 -0000 1.4 > +++ patches/patch-src_extension_internal_pdfinput_poppler-cairo-font-engine_cpp 9 Sep 2025 21:19:08 -0000 > @@ -1,4 +1,6 @@ > -Fix build with poppler-25.07. > +Fix build with poppler-25.07 and 25.09.1. > + > +Partially from upstream commit b60d81745016b5f20d4c6aec6d073b8a6f3e499c. > > Index: src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp > --- src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp.orig > @@ -56,3 +58,12 @@ Index: src/extension/internal/pdfinput/p > } else { > ff = FoFiTrueType::load(fileName.c_str(), 0); > } > +@@ -629,7 +628,7 @@ static cairo_status_t _init_type3_glyph(cairo_scaled_f > + > + info = (type3_font_info_t *)cairo_font_face_get_user_data(cairo_scaled_font_get_font_face(scaled_font), > + &type3_font_key); > +- const double *mat = info->font->getFontBBox(); > ++ const auto& mat = info->font->getFontBBox(); > + extents->ascent = mat[3]; /* y2 */ > + extents->descent = -mat[3]; /* -y1 */ > + extents->height = extents->ascent + extents->descent; > Index: patches/patch-src_extension_internal_pdfinput_poppler-utils_cpp > =================================================================== > RCS file: patches/patch-src_extension_internal_pdfinput_poppler-utils_cpp > diff -N patches/patch-src_extension_internal_pdfinput_poppler-utils_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_extension_internal_pdfinput_poppler-utils_cpp 9 Sep 2025 21:19:08 -0000 > @@ -0,0 +1,18 @@ > +Fix build with poppler-25.09.1. > + > +From upstream commit b60d81745016b5f20d4c6aec6d073b8a6f3e499c. > + > +Index: src/extension/internal/pdfinput/poppler-utils.cpp > +--- src/extension/internal/pdfinput/poppler-utils.cpp.orig > ++++ src/extension/internal/pdfinput/poppler-utils.cpp > +@@ -38,6 +38,10 @@ Geom::Affine ctmToAffine(const double *ctm) > + return Geom::Affine(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]); > + } > + > ++Geom::Affine ctmToAffine(const std::array& ctm) { > ++ return ctmToAffine(ctm.data()); > ++} > ++ > + void ctmout(const char *label, const double *ctm) > + { > + std::cout << "C:" << label << ":" << ctm[0] << "," << ctm[1] << "," << ctm[2] << "," << ctm[3] << "," << ctm[4] > Index: patches/patch-src_extension_internal_pdfinput_poppler-utils_h > =================================================================== > RCS file: patches/patch-src_extension_internal_pdfinput_poppler-utils_h > diff -N patches/patch-src_extension_internal_pdfinput_poppler-utils_h > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_extension_internal_pdfinput_poppler-utils_h 9 Sep 2025 21:19:08 -0000 > @@ -0,0 +1,26 @@ > +Fix build with poppler-25.09.1. > + > +From upstream commit b60d81745016b5f20d4c6aec6d073b8a6f3e499c. > + > +Index: src/extension/internal/pdfinput/poppler-utils.h > +--- src/extension/internal/pdfinput/poppler-utils.h.orig > ++++ src/extension/internal/pdfinput/poppler-utils.h > +@@ -13,6 +13,7 @@ > + #ifndef POPPLER_UTILS_H > + #define POPPLER_UTILS_H > + > ++#include > + #include > + #include > + #include > +@@ -36,7 +37,10 @@ class Ref; > + class XRef; > + > + Geom::Affine stateToAffine(GfxState *state); > ++// this function is for Poppler older than v25.09.0 > + Geom::Affine ctmToAffine(const double *ctm); > ++// this flavor is for Poppler v25.09.0 and above > ++Geom::Affine ctmToAffine(const std::array& ctm); > + > + void ctmout(const char *label, const double *ctm); > + void affout(const char *label, Geom::Affine affine); > Index: patches/patch-src_extension_internal_pdfinput_svg-builder_cpp > =================================================================== > RCS file: patches/patch-src_extension_internal_pdfinput_svg-builder_cpp > diff -N patches/patch-src_extension_internal_pdfinput_svg-builder_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_extension_internal_pdfinput_svg-builder_cpp 9 Sep 2025 21:19:08 -0000 > @@ -0,0 +1,25 @@ > +Fix build with poppler-25.09.1. > + > +From upstream commit b60d81745016b5f20d4c6aec6d073b8a6f3e499c. > + > +Index: src/extension/internal/pdfinput/svg-builder.cpp > +--- src/extension/internal/pdfinput/svg-builder.cpp.orig > ++++ src/extension/internal/pdfinput/svg-builder.cpp > +@@ -1025,7 +1025,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPatte > + pattern_node->setAttribute("patternUnits", "userSpaceOnUse"); > + // Set pattern tiling > + // FIXME: don't ignore XStep and YStep > +- const double *bbox = tiling_pattern->getBBox(); > ++ const auto& bbox = tiling_pattern->getBBox(); > + pattern_node->setAttributeSvgDouble("x", 0.0); > + pattern_node->setAttributeSvgDouble("y", 0.0); > + pattern_node->setAttributeSvgDouble("width", bbox[2] - bbox[0]); > +@@ -1255,7 +1255,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shar > + > + auto new_font_size = state->getFontSize(); > + if (font->getType() == fontType3) { > +- const double *font_matrix = font->getFontMatrix(); > ++ const auto& font_matrix = font->getFontMatrix(); > + if (font_matrix[0] != 0.0) { > + new_font_size *= font_matrix[3] / font_matrix[0]; > + }