inkscape/inkscape-1.3.2-poppler-24.05.0.patch

65 lines
2.6 KiB
Diff
Raw Normal View History

From 96ca7a6c215aa14336b52753f56244dc8796ec43 Mon Sep 17 00:00:00 2001
From: Heiko Becker <mail@heiko-becker.de>
Date: Fri, 3 May 2024 14:52:00 +0200
Subject: [PATCH] Fix build with poppler >= 24.05.0
GooString::hasUnicodeMarkerLE and GooString::hasUnicodeMarker were
rename and moved to UTF.h [1][2]
[1] https://gitlab.freedesktop.org/poppler/poppler/-/commit/98fabb298b0e8eaef9193bbce68c99c85473a314
[2] https://gitlab.freedesktop.org/poppler/poppler/-/commit/1f06dca08c32ed18c3030530d98a0e30d41dd7a2
---
src/extension/internal/pdfinput/poppler-transition-api.h | 9 +++++++++
src/extension/internal/pdfinput/poppler-utils.cpp | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 58aa1ec921d..481aefadf46 100644
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -13,6 +13,15 @@
#define SEEN_POPPLER_TRANSITION_API_H
#include <glib/poppler-features.h>
+#include <poppler/UTF.h>
+
+#if POPPLER_CHECK_VERSION(24, 5, 0)
+#define _POPPLER_HAS_UNICODE_BOM(value) (hasUnicodeByteOrderMark(value->toStr()))
+#define _POPPLER_HAS_UNICODE_BOMLE(value) (hasUnicodeByteOrderMarkLE(value->toStr()))
+#else
+#define _POPPLER_HAS_UNICODE_BOM(value) (value->hasUnicodeMarker())
+#define _POPPLER_HAS_UNICODE_BOMLE(value) (value->hasUnicodeMarkerLE())
+#endif
#if POPPLER_CHECK_VERSION(24, 3, 0)
#define _POPPLER_FUNCTION_TYPE_SAMPLED Function::Type::Sampled
diff --git a/src/extension/internal/pdfinput/poppler-utils.cpp b/src/extension/internal/pdfinput/poppler-utils.cpp
index 78d90c66c9d..c02815f64b9 100644
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -12,6 +12,8 @@
#include "poppler-utils.h"
+#include <poppler/UTF.h>
+
#include "2geom/affine.h"
#include "GfxFont.h"
#include "GfxState.h"
@@ -563,10 +565,10 @@ std::string getDictString(Dict *dict, const char *key)
*/
std::string getString(const GooString *value)
{
- if (value->hasUnicodeMarker()) {
+ if (_POPPLER_HAS_UNICODE_BOM(value)) {
return g_convert(value->getCString () + 2, value->getLength () - 2,
"UTF-8", "UTF-16BE", NULL, NULL, NULL);
- } else if (value->hasUnicodeMarkerLE()) {
+ } else if (_POPPLER_HAS_UNICODE_BOMLE(value)) {
return g_convert(value->getCString () + 2, value->getLength () - 2,
"UTF-8", "UTF-16LE", NULL, NULL, NULL);
}
--
GitLab