inkscape: update to 1.4.3

This commit is contained in:
Alex Lohr
2026-03-17 00:15:57 +01:00
committed by Duncan Overbruck
parent 506608f7f5
commit ac5380b275
5 changed files with 3 additions and 698 deletions
@@ -1,395 +0,0 @@
From 97bd8f29a61e691ceea98ca2444b974cf4256ae0 Mon Sep 17 00:00:00 2001
From: Rafael Siejakowski <rs@rs-math.net>
Date: Sun, 8 Jun 2025 21:30:44 +0200
Subject: [PATCH 1/2] Fix build against Poppler 25.06
Accommodate for the private API change, whereby an array of pointers
has been replaced with a vector of unique_ptr.
Backported from MR 7261
https://gitlab.com/inkscape/inkscape/-/merge_requests/7261
Fixes https://gitlab.com/inkscape/inkscape/-/issues/5836
---
.../internal/pdfinput/pdf-parser.cpp | 23 +++++++++++--------
.../pdfinput/poppler-transition-api.h | 12 ++++++++++
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 01d7bf6ef0e..0d31eda16f4 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -27,6 +27,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <memory>
#include <mutex> // std::call_once()
#include <utility>
#include <vector>
@@ -686,7 +687,6 @@ void PdfParser::opSetLineWidth(Object args[], int /*numArgs*/)
void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
{
Object obj1, obj2, obj3, obj4, obj5;
- Function *funcs[4] = {nullptr, nullptr, nullptr, nullptr};
GfxColor backdropColor;
GBool haveBackdropColor = gFalse;
GBool alpha = gFalse;
@@ -744,13 +744,14 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
state->setLineWidth(obj2.getNum());
}
+ _POPPLER_DECLARE_TRANSFER_FUNCTION_VECTOR(funcs);
+
// transfer function
if (_POPPLER_CALL_ARGS_DEREF(obj2, obj1.dictLookup, "TR2").isNull()) {
_POPPLER_CALL_ARGS(obj2, obj1.dictLookup, "TR");
}
if (obj2.isName(const_cast<char *>("Default")) || obj2.isName(const_cast<char *>("Identity"))) {
- funcs[0] = funcs[1] = funcs[2] = funcs[3] = nullptr;
- state->setTransfer(funcs);
+ state->setTransfer(std::move(funcs));
} else if (obj2.isArray() && obj2.arrayGetLength() == 4) {
int pos = 4;
for (int i = 0; i < 4; ++i) {
@@ -763,12 +764,14 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
}
_POPPLER_FREE(obj3);
if (pos == 4) {
- state->setTransfer(funcs);
+ state->setTransfer(std::move(funcs));
}
} else if (obj2.isName() || obj2.isDict() || obj2.isStream()) {
if ((funcs[0] = Function::parse(&obj2))) {
- funcs[1] = funcs[2] = funcs[3] = nullptr;
- state->setTransfer(funcs);
+ funcs[1] = nullptr;
+ funcs[2] = nullptr;
+ funcs[3] = nullptr;
+ state->setTransfer(std::move(funcs));
}
} else if (!obj2.isNull()) {
error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState");
@@ -790,8 +793,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
funcs[0] = Function::parse(&obj3);
if (funcs[0]->getInputSize() != 1 || funcs[0]->getOutputSize() != 1) {
error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState");
- delete funcs[0];
- funcs[0] = nullptr;
+ _POPPLER_DELETE_TRANSFER_FUNCTION(funcs[0]);
}
}
_POPPLER_FREE(obj3);
@@ -835,9 +837,10 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
}
}
}
- doSoftMask(&obj3, alpha, blendingColorSpace.get(), isolated, knockout, funcs[0], &backdropColor);
+ doSoftMask(&obj3, alpha, blendingColorSpace.get(), isolated, knockout,
+ _POPPLER_GET_TRANSFER_FUNCTION_POINTER(funcs[0]), &backdropColor);
if (funcs[0]) {
- delete funcs[0];
+ _POPPLER_DELETE_TRANSFER_FUNCTION(funcs[0]);
}
} else {
error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index a67132ba6bd..d04412757bc 100644
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -15,6 +15,18 @@
#include <glib/poppler-features.h>
#include <poppler/UTF.h>
+#if POPPLER_CHECK_VERSION(25, 6, 0)
+#define _POPPLER_DECLARE_TRANSFER_FUNCTION_VECTOR(name) std::vector<std::unique_ptr<Function>> name(4)
+#define _POPPLER_DELETE_TRANSFER_FUNCTION(name) name.reset()
+#define _POPPLER_GET_TRANSFER_FUNCTION_POINTER(name) name.get()
+#else
+#define _POPPLER_DECLARE_TRANSFER_FUNCTION_VECTOR(name) Function *name[4] = {}
+#define _POPPLER_DELETE_TRANSFER_FUNCTION(name) \
+ delete name; \
+ name = nullptr
+#define _POPPLER_GET_TRANSFER_FUNCTION_POINTER(name) name
+#endif
+
#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()
--
GitLab
From b4fcfc7969329513afa83e8c0cf52e3e36eae041 Mon Sep 17 00:00:00 2001
From: Rafael Siejakowski <rs@rs-math.net>
Date: Mon, 9 Jun 2025 13:51:59 +0200
Subject: [PATCH 2/2] Fix includes in PDF input extensions
This commit fixes a build error against a non-system libpoppler.
The include directives referencing Poppler's private headers are "system"
includes, so they should use angular brackets. The path prefix "poppler/"
is necessary to ensure they work correctly against a custom Poppler
installation.
In addition, several includes of lib2geom are also converted to angular
brackets. A handful of unused includes are removed.
---
.../internal/pdfinput/pdf-parser.cpp | 42 +++++++++----------
src/extension/internal/pdfinput/pdf-parser.h | 9 ++--
src/extension/internal/pdfinput/pdf-utils.h | 9 ++--
.../pdfinput/poppler-cairo-font-engine.cpp | 13 +++---
.../pdfinput/poppler-cairo-font-engine.h | 4 +-
.../internal/pdfinput/poppler-utils.cpp | 8 ++--
.../internal/pdfinput/svg-builder.cpp | 28 ++++++-------
src/extension/internal/pdfinput/svg-builder.h | 4 +-
8 files changed, 56 insertions(+), 61 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 0d31eda16f4..0773e389085 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -22,42 +22,40 @@
#pragma implementation
#endif
+#include <2geom/transforms.h>
#include <cmath>
-#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <glib/poppler-features.h>
+#include <goo/GooString.h>
+#include <goo/gmem.h>
#include <memory>
#include <mutex> // std::call_once()
+#include <poppler/Annot.h>
+#include <poppler/Array.h>
+#include <poppler/CharTypes.h>
+#include <poppler/Dict.h>
+#include <poppler/Error.h>
+#include <poppler/Gfx.h>
+#include <poppler/GfxFont.h>
+#include <poppler/GfxState.h>
+#include <poppler/GlobalParams.h>
+#include <poppler/Lexer.h>
+#include <poppler/Object.h>
+#include <poppler/OutputDev.h>
+#include <poppler/PDFDoc.h>
+#include <poppler/Page.h>
+#include <poppler/Parser.h>
+#include <poppler/Stream.h>
#include <utility>
#include <vector>
-#include <2geom/transforms.h>
-#include "Annot.h"
-#include "Array.h"
-#include "CharTypes.h"
-#include "Dict.h"
-#include "Error.h"
-#include "Gfx.h"
-#include "GfxFont.h"
-#include "GfxState.h"
-#include "GlobalParams.h"
-#include "Lexer.h"
-#include "Object.h"
-#include "OutputDev.h"
-#include "PDFDoc.h"
-#include "Page.h"
-#include "Parser.h"
-#include "Stream.h"
-#include "glib/poppler-features.h"
-#include "goo/GooString.h"
-#include "goo/gmem.h"
#include "pdf-utils.h"
#include "poppler-cairo-font-engine.h"
#include "poppler-transition-api.h"
#include "poppler-utils.h"
#include "svg-builder.h"
-#include "util/units.h"
// the MSVC math.h doesn't define this
#ifndef M_PI
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h
index 99a205d186d..2c3a57bf50c 100644
--- a/src/extension/internal/pdfinput/pdf-parser.h
+++ b/src/extension/internal/pdfinput/pdf-parser.h
@@ -25,16 +25,15 @@
#pragma interface
#endif
-#include "glib/poppler-features.h"
-#include "Object.h"
-
+#include <2geom/affine.h>
+#include <glib/poppler-features.h>
#include <map>
#include <memory>
+#include <poppler/Object.h>
#include <string>
-#include <2geom/affine.h>
#define Operator Operator_Gfx
-#include <Gfx.h>
+#include <poppler/Gfx.h>
#undef Operator
namespace Inkscape::Extension::Internal {
diff --git a/src/extension/internal/pdfinput/pdf-utils.h b/src/extension/internal/pdfinput/pdf-utils.h
index e1a449a4e38..c1d602bec00 100644
--- a/src/extension/internal/pdfinput/pdf-utils.h
+++ b/src/extension/internal/pdfinput/pdf-utils.h
@@ -11,12 +11,13 @@
#ifndef PDF_UTILS_H
#define PDF_UTILS_H
+#include <2geom/affine.h>
#include <2geom/rect.h>
+#include <poppler/Gfx.h>
+#include <poppler/GfxState.h>
+#include <poppler/Page.h>
+
#include "poppler-transition-api.h"
-#include "2geom/affine.h"
-#include "Gfx.h"
-#include "GfxState.h"
-#include "Page.h"
class ClipHistoryEntry
{
diff --git a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
index 5e1a6426250..dff615cb616 100644
--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
+++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
@@ -47,14 +47,11 @@
#include <cstring>
#include <fofi/FoFiTrueType.h>
#include <fofi/FoFiType1C.h>
-#include <fstream>
-
-#include "Error.h"
-#include "Gfx.h"
-#include "GlobalParams.h"
-#include "Page.h"
-#include "XRef.h"
-#include "goo/gfile.h"
+#include <poppler/Error.h>
+#include <poppler/Gfx.h>
+#include <poppler/GlobalParams.h>
+#include <poppler/Page.h>
+#include <poppler/XRef.h>
//========================================================================
//
diff --git a/src/extension/internal/pdfinput/poppler-cairo-font-engine.h b/src/extension/internal/pdfinput/poppler-cairo-font-engine.h
index d3e1a94e845..114a23181a7 100644
--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.h
+++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.h
@@ -36,11 +36,11 @@
#include <memory>
#include <mutex>
#include <optional>
+#include <poppler/GfxFont.h>
+#include <poppler/PDFDoc.h>
#include <unordered_map>
#include <vector>
-#include "GfxFont.h"
-#include "PDFDoc.h"
#include "poppler-config.h"
#include "poppler-transition-api.h"
diff --git a/src/extension/internal/pdfinput/poppler-utils.cpp b/src/extension/internal/pdfinput/poppler-utils.cpp
index ad0dd236a2a..a579ffcacf3 100644
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -12,12 +12,12 @@
#include "poppler-utils.h"
+#include <2geom/affine.h>
+#include <poppler/GfxFont.h>
+#include <poppler/GfxState.h>
+#include <poppler/PDFDoc.h>
#include <poppler/UTF.h>
-#include "2geom/affine.h"
-#include "GfxFont.h"
-#include "GfxState.h"
-#include "PDFDoc.h"
#include "libnrtype/font-factory.h"
/**
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index cdd8d755e82..f14be1ec62e 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -27,26 +27,28 @@
#ifdef HAVE_POPPLER
-#include "Function.h"
-#include "GfxFont.h"
-#include "GfxState.h"
-#include "Page.h"
-#include "Stream.h"
+#include <poppler/Function.h>
+#include <poppler/GfxFont.h>
+#include <poppler/GfxState.h>
+#include <poppler/Page.h>
+#include <poppler/Stream.h>
+
#include "color.h"
+#include "color/cms-util.h"
+#include "display/cairo-utils.h"
+#include "display/nr-filter-utils.h"
#include "document.h"
#include "extract-uri.h"
+#include "helper/geom.h"
+#include "object/sp-defs.h"
+#include "object/sp-item-group.h"
+#include "object/sp-namedview.h"
+#include "object/sp-text.h"
#include "pdf-parser.h"
#include "pdf-utils.h"
#include "png.h"
#include "poppler-cairo-font-engine.h"
#include "profile-manager.h"
-
-#include "color/cms-util.h"
-#include "display/cairo-utils.h"
-#include "display/nr-filter-utils.h"
-#include "object/sp-defs.h"
-#include "object/sp-item-group.h"
-#include "object/sp-namedview.h"
#include "svg/css-ostringstream.h"
#include "svg/path-string.h"
#include "svg/svg.h"
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h
index ae6b916bcb0..db42f81b87d 100644
--- a/src/extension/internal/pdfinput/svg-builder.h
+++ b/src/extension/internal/pdfinput/svg-builder.h
@@ -27,7 +27,7 @@ namespace Inkscape {
}
#define Operator Operator_Gfx
-#include <Gfx.h>
+#include <poppler/Gfx.h>
#undef Operator
#include <2geom/affine.h>
@@ -35,8 +35,8 @@ namespace Inkscape {
#include <cairo-ft.h>
#include <glibmm/ustring.h>
#include <lcms2.h>
+#include <poppler/CharTypes.h>
-#include "CharTypes.h"
#include "enums.h"
#include "poppler-utils.h"
class Function;
--
GitLab
@@ -1,124 +0,0 @@
From ce52c5f96106ae5747171663a46831f21aa52d95 Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Sun, 6 Jul 2025 15:42:13 +0200
Subject: [PATCH] Fix building with Poppler 25.07.0
Fix building issues with
1. [`GfxState::shift()`](https://gitlab.freedesktop.org/poppler/poppler/-/commit/71bf5552d448a6fdb666f2b61764b61ca197617d)
2. [`FoFiTrueType::make` and `FoFiType1C::make`](FoFiTrueType::make)
3. Fix typo from 5c4c6d116dae5250d75d34a45f0d9220824d2e20
---
src/extension/internal/pdfinput/pdf-parser.cpp | 4 ++--
.../pdfinput/poppler-cairo-font-engine.cpp | 16 +++++++++++-----
.../internal/pdfinput/poppler-transition-api.h | 14 ++++++++++++++
3 files changed, 27 insertions(+), 7 deletions(-)
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -2313,11 +2313,11 @@ void PdfParser::doShowText(GooString *s)
state->textTransformDelta(originX, originY, &tOriginX, &tOriginY);
// In Gfx.cc this is drawChar(...)
- builder->addChar(state, state->getCurX() + riseX, state->getCurY() + riseY,
+ builder->addChar(state, state->_POPPLER_GET_CUR_TEXT_X() + riseX, state->_POPPLER_GET_CUR_TEXT_Y() + riseY,
dx, dy, ax, ay, tOriginX, tOriginY, code, n, u, uLen);
// Move onto next unicode character.
- state->shift(tdx, tdy);
+ state->_POPPLER_TEXT_SHIFT_WITH_USER_COORDS(tdx, tdy);
p += n;
len -= n;
}
--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
+++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
@@ -315,7 +315,11 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
#endif
char **enc;
const char *name;
+#if POPPLER_CHECK_VERSION(25, 7, 0)
+ std::unique_ptr<FoFiType1C> ff1c;
+#else
FoFiType1C *ff1c;
+#endif
std::optional<FreeTypeFontFace> font_face;
std::vector<int> codeToGID;
bool substitute = false;
@@ -426,7 +430,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
FoFiTrueType *ff;
#endif
if (!font_data.empty()) {
- ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), 0);
+ ff = _POPPLER_FOFI_TRUETYPE_MAKE(font_data, 0);
} else {
ff = FoFiTrueType::load(fileName.c_str(), 0);
}
@@ -456,7 +460,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
FoFiTrueType *ff;
#endif
if (!font_data.empty()) {
- ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), 0);
+ ff = _POPPLER_FOFI_TRUETYPE_MAKE(font_data, 0);
} else {
ff = FoFiTrueType::load(fileName.c_str(), 0);
}
@@ -490,7 +494,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
case fontCIDType0C:
if (!useCIDs) {
if (!font_data.empty()) {
- ff1c = FoFiType1C::make((fontchar)font_data.data(), font_data.size());
+ ff1c = _POPPLER_FOFI_TYPE1C_MAKE(font_data);
} else {
ff1c = FoFiType1C::load(fileName.c_str());
}
@@ -503,7 +507,9 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
codeToGID.insert(codeToGID.begin(), src, src + n);
gfree(src);
#endif
+#if !(POPPLER_CHECK_VERSION(25, 7, 0))
delete ff1c;
+#endif
}
}
@@ -539,13 +545,13 @@ CairoFreeTypeFont *CairoFreeTypeFont::cr
FoFiTrueType *ff;
#endif
if (!font_data.empty()) {
- ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), 0);
+ ff = _POPPLER_FOFI_TRUETYPE_MAKE(font_data, 0);
} else {
ff = FoFiTrueType::load(fileName.c_str(), 0);
}
if (ff) {
if (ff->isOpenTypeCFF()) {
- auto src = ff1c->_POPPLER_GET_CID_TO_GID_MAP(&n);
+ auto src = ff->_POPPLER_GET_CID_TO_GID_MAP(&n);
#if POPPLER_CHECK_VERSION(25,2,0)
codeToGID = std::move(src);
#else
--- 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, 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)
+#define _POPPLER_FOFI_TYPE1C_MAKE(font_data) FoFiType1C::make(std::span(font_data))
+#define _POPPLER_GET_CUR_TEXT_X() getCurTextX()
+#define _POPPLER_GET_CUR_TEXT_Y() getCurTextY()
+#else
+#define _POPPLER_TEXT_SHIFT_WITH_USER_COORDS(dx, dy) shift(dx, dy)
+#define _POPPLER_FOFI_TRUETYPE_MAKE(font_data, faceIndex) FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), faceIndex)
+#define _POPPLER_FOFI_TYPE1C_MAKE(font_data) FoFiType1C::make((fontchar)font_data.data(), font_data.size())
+#define _POPPLER_GET_CUR_TEXT_X() getCurX()
+#define _POPPLER_GET_CUR_TEXT_Y() getCurY()
+#endif
+
#if POPPLER_CHECK_VERSION(25, 6, 0)
#define _POPPLER_DECLARE_TRANSFER_FUNCTION_VECTOR(name) std::vector<std::unique_ptr<Function>> name(4)
#define _POPPLER_DELETE_TRANSFER_FUNCTION(name) name.reset()
@@ -1,96 +0,0 @@
From b60d81745016b5f20d4c6aec6d073b8a6f3e499c Mon Sep 17 00:00:00 2001
From: mike kowalski <michal_kowalski@hotmail.com>
Date: Tue, 2 Sep 2025 07:17:25 -0700
Subject: [PATCH] Fix build with poppler 25.09.0
API changes: double* -> std::array necessitates fixes in Inkscape.
The goal is to make it build with older poppler versions too.
---
src/extension/internal/pdfinput/pdf-parser.cpp | 3 +--
src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp | 2 +-
src/extension/internal/pdfinput/poppler-utils.cpp | 4 ++++
src/extension/internal/pdfinput/poppler-utils.h | 4 ++++
src/extension/internal/pdfinput/svg-builder.cpp | 4 ++--
5 files changed, 12 insertions(+), 5 deletions(-)
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -1650,12 +1650,11 @@ void PdfParser::doFunctionShFill1(GfxFun
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) {
--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
+++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
@@ -632,7 +632,7 @@ static cairo_status_t _init_type3_glyph(
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;
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -38,6 +38,10 @@ Geom::Affine ctmToAffine(const double *c
return Geom::Affine(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
}
+Geom::Affine ctmToAffine(const std::array<double, 6>& 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]
--- a/src/extension/internal/pdfinput/poppler-utils.h
+++ b/src/extension/internal/pdfinput/poppler-utils.h
@@ -13,6 +13,7 @@
#ifndef POPPLER_UTILS_H
#define POPPLER_UTILS_H
+#include <array>
#include <map>
#include <memory>
#include <string>
@@ -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<double, 6>& ctm);
void ctmout(const char *label, const double *ctm);
void affout(const char *label, Geom::Affine affine);
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -1027,7 +1027,7 @@ gchar *SvgBuilder::_createTilingPattern(
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]);
@@ -1257,7 +1257,7 @@ void SvgBuilder::updateFont(GfxState *st
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];
}
@@ -1,80 +0,0 @@
From ace884e13e413b0cc49ece80936584ef92c986f5 Mon Sep 17 00:00:00 2001
From: mike kowalski <michal_kowalski@hotmail.com>
Date: Sun, 12 Oct 2025 10:04:22 -0700
Subject: [PATCH] Replace getLength() with size() on a GooString (Poppler)
GooString in poppler no longer defines getLength() method.
Call size() from base string directly.
---
src/extension/internal/pdfinput/pdf-parser.cpp | 4 ++--
src/extension/internal/pdfinput/poppler-utils.cpp | 6 +++---
src/extension/internal/pdfinput/poppler-utils.h | 9 +++++++++
3 files changed, 14 insertions(+), 5 deletions(-)
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -2256,7 +2256,7 @@ void PdfParser::doShowText(GooString *s)
auto font = state->getFont();
int wMode = font->getWMode(); // Vertical/Horizontal/Invalid
- builder->beginString(state, s->getLength());
+ builder->beginString(state, get_goostring_length(*s));
// handle a Type 3 char
if (font->getType() == fontType3) {
@@ -2267,7 +2267,7 @@ void PdfParser::doShowText(GooString *s)
state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
auto p = s->getCString(); // char* or const char*
- int len = s->getLength();
+ int len = get_goostring_length(*s);
while (len > 0) {
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -168,7 +168,7 @@ void InkFontDict::hashFontObject1(const
case objString:
h->hash('s');
s = obj->getString();
- h->hash(s->c_str(), s->getLength());
+ h->hash(s->c_str(), get_goostring_length(*s));
break;
case objName:
h->hash('n');
@@ -586,10 +586,10 @@ std::string getDictString(Dict *dict, co
std::string getString(const GooString *value)
{
if (_POPPLER_HAS_UNICODE_BOM(value)) {
- return g_convert(value->getCString () + 2, value->getLength () - 2,
+ return g_convert(value->getCString () + 2, get_goostring_length(*value) - 2,
"UTF-8", "UTF-16BE", NULL, NULL, NULL);
} else if (_POPPLER_HAS_UNICODE_BOMLE(value)) {
- return g_convert(value->getCString () + 2, value->getLength () - 2,
+ return g_convert(value->getCString () + 2, get_goostring_length(*value) - 2,
"UTF-8", "UTF-16LE", NULL, NULL, NULL);
}
return value->toStr();
--- a/src/extension/internal/pdfinput/poppler-utils.h
+++ b/src/extension/internal/pdfinput/poppler-utils.h
@@ -19,6 +19,7 @@
#include <string>
#include <unordered_set>
#include <vector>
+#include <goo/GooString.h>
#include "poppler-transition-api.h"
@@ -104,4 +105,12 @@ private:
void hashFontObject1(const Object *obj, FNVHash *h);
};
+inline size_t get_goostring_length(const GooString& str) {
+#if POPPLER_CHECK_VERSION(25, 10, 0)
+ return str.size();
+#else
+ return str.getLength();
+#endif
+}
+
#endif /* POPPLER_UTILS_H */
+3 -3
View File
@@ -1,7 +1,7 @@
# Template file for 'inkscape'
pkgname=inkscape
version=1.4.2
revision=4
version=1.4.3
revision=1
build_style=cmake
make_check_target="check"
hostmakedepends="automake gettext glib-devel intltool libgraphicsmagick-devel
@@ -21,7 +21,7 @@ maintainer="Alex Lohr <alexthkloss@web.de>"
license="GPL-2.0-only, LGPL-2.1-or-later"
homepage="https://inkscape.org/"
distfiles="https://media.inkscape.org/dl/resources/file/inkscape-${version}.tar.xz"
checksum=2000530c7917e5260c9e8575a7154ff6926643d2006487d714e304a963f0c782
checksum=e83a2c3db570b6c5a1ff0fccfe7098837b3f6bd74b133567937c8a91710ed1d1
python_version=3
# some tests still fail on musl: https://gitlab.com/inkscape/inkscape/-/issues/2241
make_check=no