]>
Commit | Line | Data |
---|---|---|
2626cb36 JB |
1 | From 85c0dff3422fa3c26fbc2e8d8561f597ec24bd92 Mon Sep 17 00:00:00 2001 |
2 | From: Jean Ghali <jghali@libertysurf.fr> | |
3 | Date: Wed, 2 Feb 2022 23:12:52 +0000 | |
4 | Subject: [PATCH] #16734: Build break with poppler 22.2.0 | |
5 | ||
6 | git-svn-id: svn://scribus.net/trunk/Scribus@24884 11d20701-8431-0410-a711-e3c959e3b870 | |
7 | --- | |
8 | scribus/plugins/import/pdf/slaoutput.cpp | 47 +++++++++++++++++++----- | |
9 | 1 file changed, 37 insertions(+), 10 deletions(-) | |
10 | ||
11 | diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp | |
12 | index 5894bf2ad6..3650c96f52 100644 | |
13 | --- a/scribus/plugins/import/pdf/slaoutput.cpp | |
14 | +++ b/scribus/plugins/import/pdf/slaoutput.cpp | |
15 | @@ -7,6 +7,11 @@ for which a new license (GPL+exception) is in place. | |
16 | \r | |
17 | #include "slaoutput.h"\r | |
18 | \r | |
19 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
20 | +#include <memory>\r | |
21 | +#include <optional>\r | |
22 | +#endif\r | |
23 | +\r | |
24 | #include <poppler/GlobalParams.h>\r | |
25 | #include <poppler/poppler-config.h>\r | |
26 | #include <poppler/FileSpec.h>\r | |
27 | @@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties) | |
28 | void SlaOutputDev::updateFont(GfxState *state)\r | |
29 | {\r | |
30 | GfxFont *gfxFont;\r | |
31 | - GfxFontLoc *fontLoc;\r | |
32 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
33 | + std::optional<GfxFontLoc> fontLoc;\r | |
34 | + const GooString * fileName = nullptr;\r | |
35 | + std::unique_ptr<FoFiTrueType> ff;\r | |
36 | +#else\r | |
37 | + GfxFontLoc * fontLoc = nullptr;\r | |
38 | + GooString * fileName = nullptr;\r | |
39 | + FoFiTrueType * ff = nullptr;\r | |
40 | +#endif\r | |
41 | GfxFontType fontType;\r | |
42 | SlaOutFontFileID *id;\r | |
43 | SplashFontFile *fontFile;\r | |
44 | SplashFontSrc *fontsrc = nullptr;\r | |
45 | - FoFiTrueType *ff;\r | |
46 | Object refObj, strObj;\r | |
47 | - GooString *fileName;\r | |
48 | - char *tmpBuf;\r | |
49 | + char *tmpBuf = nullptr;\r | |
50 | int tmpBufLen = 0;\r | |
51 | - int *codeToGID;\r | |
52 | - const double *textMat;\r | |
53 | + int *codeToGID = nullptr;\r | |
54 | + const double *textMat = nullptr;\r | |
55 | double m11, m12, m21, m22, fontSize;\r | |
56 | SplashCoord mat[4];\r | |
57 | int n = 0;\r | |
58 | @@ -3046,9 +3057,6 @@ void SlaOutputDev::updateFont(GfxState *state) | |
59 | SplashCoord matrix[6];\r | |
60 | \r | |
61 | m_font = nullptr;\r | |
62 | - fileName = nullptr;\r | |
63 | - tmpBuf = nullptr;\r | |
64 | - fontLoc = nullptr;\r | |
65 | \r | |
66 | gfxFont = state->getFont();\r | |
67 | if (!gfxFont)\r | |
68 | @@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state) | |
69 | }\r | |
70 | else\r | |
71 | { // gfxFontLocExternal\r | |
72 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
73 | + fileName = fontLoc->pathAsGooString();\r | |
74 | +#else\r | |
75 | fileName = fontLoc->path;\r | |
76 | +#endif\r | |
77 | fontType = fontLoc->fontType;\r | |
78 | }\r | |
79 | \r | |
80 | @@ -3136,9 +3148,14 @@ void SlaOutputDev::updateFont(GfxState *state) | |
81 | ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r | |
82 | if (ff)\r | |
83 | {\r | |
84 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
85 | + codeToGID = ((Gfx8BitFont*) gfxFont)->getCodeToGIDMap(ff.get());\r | |
86 | + ff.reset();\r | |
87 | +#else\r | |
88 | codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);\r | |
89 | - n = 256;\r | |
90 | delete ff;\r | |
91 | +#endif\r | |
92 | + n = 256;\r | |
93 | }\r | |
94 | else\r | |
95 | {\r | |
96 | @@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state) | |
97 | ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r | |
98 | if (! ff)\r | |
99 | goto err2;\r | |
100 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
101 | + codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);\r | |
102 | + ff.reset();\r | |
103 | +#else\r | |
104 | codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);\r | |
105 | delete ff;\r | |
106 | +#endif\r | |
107 | }\r | |
108 | if (!(fontFile = m_fontEngine->loadTrueTypeFont(\r | |
109 | id,\r | |
110 | @@ -3247,14 +3269,19 @@ void SlaOutputDev::updateFont(GfxState *state) | |
111 | mat[3] = -m22;\r | |
112 | m_font = m_fontEngine->getFont(fontFile, mat, matrix);\r | |
113 | \r | |
114 | +#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
115 | delete fontLoc;\r | |
116 | +#endif\r | |
117 | if (fontsrc && !fontsrc->isFile)\r | |
118 | fontsrc->unref();\r | |
119 | return;\r | |
120 | \r | |
121 | err2:\r | |
122 | delete id;\r | |
123 | +#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
124 | delete fontLoc;\r | |
125 | +#endif\r | |
126 | +\r | |
127 | err1:\r | |
128 | if (fontsrc && !fontsrc->isFile)\r | |
129 | fontsrc->unref();\r | |
130 | From f75c1613db67f4067643d0218a2db3235e42ec9f Mon Sep 17 00:00:00 2001 | |
131 | From: Jean Ghali <jghali@libertysurf.fr> | |
132 | Date: Thu, 3 Feb 2022 19:46:13 +0000 | |
133 | Subject: [PATCH] Small update vs latest code in poppler | |
134 | ||
135 | git-svn-id: svn://scribus.net/trunk/Scribus@24885 11d20701-8431-0410-a711-e3c959e3b870 | |
136 | --- | |
137 | scribus/plugins/import/pdf/slaoutput.cpp | 6 +++--- | |
138 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
139 | ||
140 | diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp | |
141 | index 3650c96f52..a6f4e00fa9 100644 | |
142 | --- a/scribus/plugins/import/pdf/slaoutput.cpp | |
143 | +++ b/scribus/plugins/import/pdf/slaoutput.cpp | |
144 | @@ -3072,10 +3072,10 @@ void SlaOutputDev::updateFont(GfxState *state) | |
145 | delete id;\r | |
146 | else\r | |
147 | {\r | |
148 | - if (!(fontLoc = gfxFont->locateFont(xref, nullptr)))\r | |
149 | + fontLoc = gfxFont->locateFont((xref) ? xref : pdfDoc->getXRef(), nullptr);\r | |
150 | + if (!fontLoc)\r | |
151 | {\r | |
152 | - error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",\r | |
153 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
154 | + error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
155 | goto err2;\r | |
156 | }\r | |
157 | \r | |
158 | From f19410ac3b27e33dd62105746784e61e85b90a1d Mon Sep 17 00:00:00 2001 | |
159 | From: Jean Ghali <jghali@libertysurf.fr> | |
160 | Date: Wed, 2 Mar 2022 22:22:53 +0000 | |
161 | Subject: [PATCH] #16764: Build break with poppler 22.03.0 | |
162 | ||
163 | git-svn-id: svn://scribus.net/trunk/Scribus@24982 11d20701-8431-0410-a711-e3c959e3b870 | |
164 | --- | |
165 | scribus/plugins/import/pdf/importpdf.cpp | 13 +++++++++++++ | |
166 | 1 file changed, 13 insertions(+) | |
167 | ||
168 | diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp | |
169 | index 154e58a3f0..392dcd9e64 100644 | |
170 | --- a/scribus/plugins/import/pdf/importpdf.cpp | |
171 | +++ b/scribus/plugins/import/pdf/importpdf.cpp | |
172 | @@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName) | |
173 | #endif\r | |
174 | globalParams->setErrQuiet(gTrue);\r | |
175 | \r | |
176 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r | |
177 | + PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };\r | |
178 | +#else\r | |
179 | PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};\r | |
180 | +#endif\r | |
181 | if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)\r | |
182 | return QImage();\r | |
183 | \r | |
184 | @@ -342,7 +346,11 @@ bool PdfPlug::convert(const QString& fn) | |
185 | globalParams->setErrQuiet(gTrue);\r | |
186 | // globalParams->setPrintCommands(gTrue);\r | |
187 | QList<OptionalContentGroup*> ocgGroups;\r | |
188 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r | |
189 | + auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));\r | |
190 | +#else\r | |
191 | auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr, nullptr, nullptr));\r | |
192 | +#endif\r | |
193 | if (pdfDoc)\r | |
194 | {\r | |
195 | if (pdfDoc->getErrorCode() == errEncrypted)\r | |
196 | @@ -361,8 +369,13 @@ bool PdfPlug::convert(const QString& fn) | |
197 | #else\r | |
198 | auto fname = new GooString(QFile::encodeName(fn).data());\r | |
199 | #endif\r | |
200 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r | |
201 | + std::optional<GooString> userPW(std::in_place, text.toLocal8Bit().data());\r | |
202 | + pdfDoc.reset(new PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));\r | |
203 | +#else\r | |
204 | auto userPW = new GooString(text.toLocal8Bit().data());\r | |
205 | pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr));\r | |
206 | +#endif\r | |
207 | qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));\r | |
208 | }\r | |
209 | if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone))\r | |
210 | From f2237b8f0b5cf7690e864a22ef7a63a6d769fa36 Mon Sep 17 00:00:00 2001 | |
211 | From: Jean Ghali <jghali@libertysurf.fr> | |
212 | Date: Fri, 1 Apr 2022 23:52:32 +0000 | |
213 | Subject: [PATCH] Fix build with poppler 22.04.0 | |
214 | ||
215 | git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870 | |
216 | --- | |
217 | scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++--------- | |
218 | 1 file changed, 78 insertions(+), 45 deletions(-) | |
219 | ||
220 | From e013e8126d2100e8e56dea5b836ad43275429389 Mon Sep 17 00:00:00 2001 | |
221 | From: Jean Ghali <jghali@libertysurf.fr> | |
222 | Date: Wed, 2 Mar 2022 22:48:29 +0000 | |
223 | Subject: [PATCH] Enforce poppler version >= 0.86.0 | |
224 | ||
225 | git-svn-id: svn://scribus.net/trunk/Scribus@24985 11d20701-8431-0410-a711-e3c959e3b870 | |
226 | --- | |
227 | cmake/modules/Findpoppler.cmake | 4 +- | |
228 | scribus/plugins/import/pdf/importpdf.cpp | 65 ++----------- | |
229 | scribus/plugins/import/pdf/slaoutput.cpp | 114 ----------------------- | |
230 | scribus/plugins/import/pdf/slaoutput.h | 7 -- | |
231 | 4 files changed, 10 insertions(+), 180 deletions(-) | |
232 | ||
233 | diff --git a/cmake/modules/Findpoppler.cmake b/cmake/modules/Findpoppler.cmake | |
234 | index 56ce613ae9..9cab5532ab 100644 | |
235 | --- a/cmake/modules/Findpoppler.cmake | |
236 | +++ b/cmake/modules/Findpoppler.cmake | |
237 | @@ -1,8 +1,8 @@ | |
238 | #include(FindPkgConfig) | |
239 | find_package(PkgConfig QUIET) | |
240 | -pkg_search_module(poppler libpoppler>=0.62.0 poppler>=0.62.0) | |
241 | +pkg_search_module(poppler libpoppler>=0.86.0 poppler>=0.86.0) | |
242 | if (poppler_FOUND) | |
243 | - pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.62.0 poppler-cpp>=0.62.0) | |
244 | + pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.86.0 poppler-cpp>=0.86.0) | |
245 | endif(poppler_FOUND) | |
246 | ||
247 | find_path(poppler_INCLUDE_DIR | |
248 | diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp | |
249 | index 392dcd9e64..970a1a37ca 100644 | |
250 | --- a/scribus/plugins/import/pdf/importpdf.cpp | |
251 | +++ b/scribus/plugins/import/pdf/importpdf.cpp | |
252 | @@ -74,20 +74,15 @@ PdfPlug::PdfPlug(ScribusDoc* doc, int flags) | |
253 | \r | |
254 | QImage PdfPlug::readThumbnail(const QString& fName)\r | |
255 | {\r | |
256 | - QString pdfFile = QDir::toNativeSeparators(fName);\r | |
257 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r | |
258 | globalParams.reset(new GlobalParams());\r | |
259 | -#else\r | |
260 | - std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());\r | |
261 | - globalParams = globalParamsPtr.get();\r | |
262 | -#endif\r | |
263 | + globalParams->setErrQuiet(gTrue);\r | |
264 | \r | |
265 | -#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r | |
266 | + QString pdfFile = QDir::toNativeSeparators(fName);\r | |
267 | +#if defined(Q_OS_WIN32)\r | |
268 | auto fname = new GooString(pdfFile.toUtf8().data());\r | |
269 | #else\r | |
270 | auto fname = new GooString(QFile::encodeName(pdfFile).data());\r | |
271 | #endif\r | |
272 | - globalParams->setErrQuiet(gTrue);\r | |
273 | \r | |
274 | #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r | |
275 | PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };\r | |
276 | @@ -332,19 +327,15 @@ bool PdfPlug::convert(const QString& fn) | |
277 | qApp->processEvents();\r | |
278 | }\r | |
279 | \r | |
280 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r | |
281 | globalParams.reset(new GlobalParams());\r | |
282 | -#else\r | |
283 | - std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());\r | |
284 | - globalParams = globalParamsPtr.get();\r | |
285 | -#endif\r | |
286 | -#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r | |
287 | + globalParams->setErrQuiet(gTrue);\r | |
288 | +\r | |
289 | +#if defined(Q_OS_WIN32)\r | |
290 | auto fname = new GooString(fn.toUtf8().data());\r | |
291 | #else\r | |
292 | auto fname = new GooString(QFile::encodeName(fn).data());\r | |
293 | #endif\r | |
294 | - globalParams->setErrQuiet(gTrue);\r | |
295 | -// globalParams->setPrintCommands(gTrue);\r | |
296 | +\r | |
297 | QList<OptionalContentGroup*> ocgGroups;\r | |
298 | #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)\r | |
299 | auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));\r | |
300 | @@ -364,7 +355,7 @@ bool PdfPlug::convert(const QString& fn) | |
301 | QString text = QInputDialog::getText(mw, tr("Open PDF-File"), tr("Password"), QLineEdit::Normal, "", &ok);\r | |
302 | if (ok && !text.isEmpty())\r | |
303 | {\r | |
304 | -#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)\r | |
305 | +#if defined(Q_OS_WIN32)\r | |
306 | auto fname = new GooString(fn.toUtf8().data());\r | |
307 | #else\r | |
308 | auto fname = new GooString(QFile::encodeName(fn).data());\r | |
309 | @@ -382,9 +373,6 @@ bool PdfPlug::convert(const QString& fn) | |
310 | {\r | |
311 | if (m_progressDialog)\r | |
312 | m_progressDialog->close();\r | |
313 | -#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)\r | |
314 | - delete globalParams;\r | |
315 | -#endif\r | |
316 | return false;\r | |
317 | }\r | |
318 | if (m_progressDialog)\r | |
319 | @@ -494,7 +482,6 @@ bool PdfPlug::convert(const QString& fn) | |
320 | }\r | |
321 | else\r | |
322 | {\r | |
323 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)\r | |
324 | const auto& ocgs = ocg->getOCGs ();\r | |
325 | for (const auto& ocg : ocgs)\r | |
326 | {\r | |
327 | @@ -506,25 +493,11 @@ bool PdfPlug::convert(const QString& fn) | |
328 | ocgNames.append(ocgName);\r | |
329 | }\r | |
330 | }\r | |
331 | -#else\r | |
332 | - GooList *ocgs = ocg->getOCGs ();\r | |
333 | - for (int i = 0; i < ocgs->getLength (); ++i)\r | |
334 | - {\r | |
335 | - OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);\r | |
336 | - QString ocgName = UnicodeParsedString(oc->getName());\r | |
337 | - if (!ocgNames.contains(ocgName))\r | |
338 | - {\r | |
339 | - ocgGroups.prepend(oc);\r | |
340 | - ocgNames.append(ocgName);\r | |
341 | - }\r | |
342 | - }\r | |
343 | -#endif\r | |
344 | }\r | |
345 | }\r | |
346 | }\r | |
347 | else\r | |
348 | {\r | |
349 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)\r | |
350 | const auto& ocgs = ocg->getOCGs ();\r | |
351 | for (const auto& ocg : ocgs)\r | |
352 | {\r | |
353 | @@ -536,19 +509,6 @@ bool PdfPlug::convert(const QString& fn) | |
354 | ocgNames.append(ocgName);\r | |
355 | }\r | |
356 | }\r | |
357 | -#else\r | |
358 | - GooList *ocgs = ocg->getOCGs ();\r | |
359 | - for (int i = 0; i < ocgs->getLength (); ++i)\r | |
360 | - {\r | |
361 | - OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);\r | |
362 | - QString ocgName = UnicodeParsedString(oc->getName());\r | |
363 | - if (!ocgNames.contains(ocgName))\r | |
364 | - {\r | |
365 | - ocgGroups.prepend(oc);\r | |
366 | - ocgNames.append(ocgName);\r | |
367 | - }\r | |
368 | - }\r | |
369 | -#endif\r | |
370 | }\r | |
371 | }\r | |
372 | \r | |
373 | @@ -787,13 +747,8 @@ bool PdfPlug::convert(const QString& fn) | |
374 | names = catDict.dictLookup("OpenAction");\r | |
375 | if (names.isDict())\r | |
376 | {\r | |
377 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
378 | std::unique_ptr<LinkAction> linkActionUPtr = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());\r | |
379 | LinkAction *linkAction = linkActionUPtr.get();\r | |
380 | -#else\r | |
381 | - LinkAction *linkAction = nullptr;\r | |
382 | - linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());\r | |
383 | -#endif\r | |
384 | if (linkAction && (linkAction->getKind() == actionJavaScript))\r | |
385 | {\r | |
386 | LinkJavaScript *jsa = (LinkJavaScript*) linkAction;\r | |
387 | @@ -861,11 +816,7 @@ bool PdfPlug::convert(const QString& fn) | |
388 | }\r | |
389 | pdfDoc.reset();\r | |
390 | }\r | |
391 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)\r | |
392 | globalParams.reset();\r | |
393 | -#else\r | |
394 | - globalParams = nullptr;\r | |
395 | -#endif\r | |
396 | \r | |
397 | // qDebug() << "converting finished";\r | |
398 | // qDebug() << "Imported" << m_elements.count() << "Elements";\r | |
399 | diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp | |
400 | index a6f4e00fa9..b6f2b8c219 100644 | |
401 | --- a/scribus/plugins/import/pdf/slaoutput.cpp | |
402 | +++ b/scribus/plugins/import/pdf/slaoutput.cpp | |
403 | @@ -332,15 +332,9 @@ LinkAction* SlaOutputDev::SC_getAction(AnnotWidget *ano) | |
404 | }\r | |
405 | \r | |
406 | /* Replacement for the crippled Poppler function LinkAction* AnnotWidget::getAdditionalAction(AdditionalActionsType type) */\r | |
407 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
408 | std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)\r | |
409 | {\r | |
410 | std::unique_ptr<LinkAction> linkAction;\r | |
411 | -#else\r | |
412 | -LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)\r | |
413 | -{\r | |
414 | - LinkAction *linkAction = nullptr;\r | |
415 | -#endif\r | |
416 | Object obj;\r | |
417 | Ref refa = ano->getRef();\r | |
418 | \r | |
419 | @@ -467,11 +461,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do | |
420 | if (dst->isPageRef())\r | |
421 | {\r | |
422 | Ref dstr = dst->getPageRef();\r | |
423 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r | |
424 | pagNum = pdfDoc->findPage(dstr);\r | |
425 | -#else\r | |
426 | - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r | |
427 | -#endif\r | |
428 | }\r | |
429 | else\r | |
430 | pagNum = dst->getPageNum();\r | |
431 | @@ -485,11 +475,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do | |
432 | POPPLER_CONST GooString *ndst = gto->getNamedDest();\r | |
433 | if (ndst)\r | |
434 | {\r | |
435 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
436 | std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r | |
437 | -#else\r | |
438 | - LinkDest *dstn = pdfDoc->findDest(ndst);\r | |
439 | -#endif\r | |
440 | if (dstn)\r | |
441 | {\r | |
442 | if (dstn->getKind() == destXYZ)\r | |
443 | @@ -497,11 +483,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do | |
444 | if (dstn->isPageRef())\r | |
445 | {\r | |
446 | Ref dstr = dstn->getPageRef();\r | |
447 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r | |
448 | pagNum = pdfDoc->findPage(dstr);\r | |
449 | -#else\r | |
450 | - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r | |
451 | -#endif\r | |
452 | }\r | |
453 | else\r | |
454 | pagNum = dstn->getPageNum();\r | |
455 | @@ -533,11 +515,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do | |
456 | POPPLER_CONST GooString *ndst = gto->getNamedDest();\r | |
457 | if (ndst)\r | |
458 | {\r | |
459 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
460 | std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r | |
461 | -#else\r | |
462 | - LinkDest *dstn = pdfDoc->findDest(ndst);\r | |
463 | -#endif\r | |
464 | if (dstn)\r | |
465 | {\r | |
466 | if (dstn->getKind() == destXYZ)\r | |
467 | @@ -985,11 +963,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
468 | if (dst->isPageRef())\r | |
469 | {\r | |
470 | Ref dstr = dst->getPageRef();\r | |
471 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r | |
472 | pagNum = pdfDoc->findPage(dstr);\r | |
473 | -#else\r | |
474 | - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r | |
475 | -#endif\r | |
476 | }\r | |
477 | else\r | |
478 | pagNum = dst->getPageNum();\r | |
479 | @@ -1005,11 +979,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
480 | POPPLER_CONST GooString *ndst = gto->getNamedDest();\r | |
481 | if (ndst)\r | |
482 | {\r | |
483 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
484 | std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r | |
485 | -#else\r | |
486 | - LinkDest *dstn = pdfDoc->findDest(ndst);\r | |
487 | -#endif\r | |
488 | if (dstn)\r | |
489 | {\r | |
490 | if (dstn->getKind() == destXYZ)\r | |
491 | @@ -1017,11 +987,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
492 | if (dstn->isPageRef())\r | |
493 | {\r | |
494 | Ref dstr = dstn->getPageRef();\r | |
495 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)\r | |
496 | pagNum = pdfDoc->findPage(dstr);\r | |
497 | -#else\r | |
498 | - pagNum = pdfDoc->findPage(dstr.num, dstr.gen);\r | |
499 | -#endif\r | |
500 | }\r | |
501 | else\r | |
502 | pagNum = dstn->getPageNum();\r | |
503 | @@ -1061,11 +1027,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
504 | POPPLER_CONST GooString *ndst = gto->getNamedDest();\r | |
505 | if (ndst)\r | |
506 | {\r | |
507 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
508 | std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);\r | |
509 | -#else\r | |
510 | - LinkDest *dstn = pdfDoc->findDest(ndst);\r | |
511 | -#endif\r | |
512 | if (dstn)\r | |
513 | {\r | |
514 | if (dstn->getKind() == destXYZ)\r | |
515 | @@ -1139,143 +1101,91 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
516 | {\r | |
517 | if (Aact->getKind() == actionJavaScript)\r | |
518 | {\r | |
519 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
520 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
521 | -#else\r | |
522 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
523 | -#endif\r | |
524 | if (jsa->isOk())\r | |
525 | {\r | |
526 | ite->annotation().setD_act(UnicodeParsedString(jsa->getScript()));\r | |
527 | ite->annotation().setAAact(true);\r | |
528 | }\r | |
529 | }\r | |
530 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
531 | Aact.reset();\r | |
532 | -#else\r | |
533 | - Aact = nullptr;\r | |
534 | -#endif\r | |
535 | }\r | |
536 | Aact = SC_getAdditionalAction("E", ano);\r | |
537 | if (Aact)\r | |
538 | {\r | |
539 | if (Aact->getKind() == actionJavaScript)\r | |
540 | {\r | |
541 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
542 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
543 | -#else\r | |
544 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
545 | -#endif\r | |
546 | if (jsa->isOk())\r | |
547 | {\r | |
548 | ite->annotation().setE_act(UnicodeParsedString(jsa->getScript()));\r | |
549 | ite->annotation().setAAact(true);\r | |
550 | }\r | |
551 | }\r | |
552 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
553 | Aact.reset();\r | |
554 | -#else\r | |
555 | - Aact = nullptr;\r | |
556 | -#endif\r | |
557 | }\r | |
558 | Aact = SC_getAdditionalAction("X", ano);\r | |
559 | if (Aact)\r | |
560 | {\r | |
561 | if (Aact->getKind() == actionJavaScript)\r | |
562 | {\r | |
563 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
564 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
565 | -#else\r | |
566 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
567 | -#endif\r | |
568 | if (jsa->isOk())\r | |
569 | {\r | |
570 | ite->annotation().setX_act(UnicodeParsedString(jsa->getScript()));\r | |
571 | ite->annotation().setAAact(true);\r | |
572 | }\r | |
573 | }\r | |
574 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
575 | Aact.reset();\r | |
576 | -#else\r | |
577 | - Aact = nullptr;\r | |
578 | -#endif\r | |
579 | }\r | |
580 | Aact = SC_getAdditionalAction("Fo", ano);\r | |
581 | if (Aact)\r | |
582 | {\r | |
583 | if (Aact->getKind() == actionJavaScript)\r | |
584 | {\r | |
585 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
586 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
587 | -#else\r | |
588 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
589 | -#endif\r | |
590 | if (jsa->isOk())\r | |
591 | {\r | |
592 | ite->annotation().setFo_act(UnicodeParsedString(jsa->getScript()));\r | |
593 | ite->annotation().setAAact(true);\r | |
594 | }\r | |
595 | }\r | |
596 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
597 | Aact.reset();\r | |
598 | -#else\r | |
599 | - Aact = nullptr;\r | |
600 | -#endif\r | |
601 | }\r | |
602 | Aact = SC_getAdditionalAction("Bl", ano);\r | |
603 | if (Aact)\r | |
604 | {\r | |
605 | if (Aact->getKind() == actionJavaScript)\r | |
606 | {\r | |
607 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
608 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
609 | -#else\r | |
610 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
611 | -#endif\r | |
612 | if (jsa->isOk())\r | |
613 | {\r | |
614 | ite->annotation().setBl_act(UnicodeParsedString(jsa->getScript()));\r | |
615 | ite->annotation().setAAact(true);\r | |
616 | }\r | |
617 | }\r | |
618 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
619 | Aact.reset();\r | |
620 | -#else\r | |
621 | - Aact = nullptr;\r | |
622 | -#endif\r | |
623 | }\r | |
624 | Aact = SC_getAdditionalAction("C", ano);\r | |
625 | if (Aact)\r | |
626 | {\r | |
627 | if (Aact->getKind() == actionJavaScript)\r | |
628 | {\r | |
629 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
630 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
631 | -#else\r | |
632 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
633 | -#endif\r | |
634 | if (jsa->isOk())\r | |
635 | {\r | |
636 | ite->annotation().setC_act(UnicodeParsedString(jsa->getScript()));\r | |
637 | ite->annotation().setAAact(true);\r | |
638 | }\r | |
639 | }\r | |
640 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
641 | Aact.reset();\r | |
642 | -#else\r | |
643 | - Aact = nullptr;\r | |
644 | -#endif\r | |
645 | }\r | |
646 | Aact = SC_getAdditionalAction("F", ano);\r | |
647 | if (Aact)\r | |
648 | {\r | |
649 | if (Aact->getKind() == actionJavaScript)\r | |
650 | {\r | |
651 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
652 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
653 | -#else\r | |
654 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
655 | -#endif\r | |
656 | if (jsa->isOk())\r | |
657 | {\r | |
658 | ite->annotation().setF_act(UnicodeParsedString(jsa->getScript()));\r | |
659 | @@ -1283,22 +1193,14 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
660 | ite->annotation().setFormat(5);\r | |
661 | }\r | |
662 | }\r | |
663 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
664 | Aact.reset();\r | |
665 | -#else\r | |
666 | - Aact = nullptr;\r | |
667 | -#endif\r | |
668 | }\r | |
669 | Aact = SC_getAdditionalAction("K", ano);\r | |
670 | if (Aact)\r | |
671 | {\r | |
672 | if (Aact->getKind() == actionJavaScript)\r | |
673 | {\r | |
674 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
675 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
676 | -#else\r | |
677 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
678 | -#endif\r | |
679 | if (jsa->isOk())\r | |
680 | {\r | |
681 | ite->annotation().setK_act(UnicodeParsedString(jsa->getScript()));\r | |
682 | @@ -1306,33 +1208,21 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano) | |
683 | ite->annotation().setFormat(5);\r | |
684 | }\r | |
685 | }\r | |
686 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
687 | Aact.reset();\r | |
688 | -#else\r | |
689 | - Aact = nullptr;\r | |
690 | -#endif\r | |
691 | }\r | |
692 | Aact = SC_getAdditionalAction("V", ano);\r | |
693 | if (Aact)\r | |
694 | {\r | |
695 | if (Aact->getKind() == actionJavaScript)\r | |
696 | {\r | |
697 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
698 | LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();\r | |
699 | -#else\r | |
700 | - LinkJavaScript *jsa = (LinkJavaScript*) Aact;\r | |
701 | -#endif\r | |
702 | if (jsa->isOk())\r | |
703 | {\r | |
704 | ite->annotation().setV_act(UnicodeParsedString(jsa->getScript()));\r | |
705 | ite->annotation().setAAact(true);\r | |
706 | }\r | |
707 | }\r | |
708 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
709 | Aact.reset();\r | |
710 | -#else\r | |
711 | - Aact = nullptr;\r | |
712 | -#endif\r | |
713 | }\r | |
714 | }\r | |
715 | \r | |
716 | @@ -1342,11 +1232,7 @@ void SlaOutputDev::startDoc(PDFDoc *doc, XRef *xrefA, Catalog *catA) | |
717 | catalog = catA;\r | |
718 | pdfDoc = doc;\r | |
719 | updateGUICounter = 0;\r | |
720 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 84, 0)\r | |
721 | m_fontEngine = new SplashFontEngine(true, false, false, true);\r | |
722 | -#else\r | |
723 | - m_fontEngine = new SplashFontEngine(globalParams->getEnableFreeType(), false, false, true);\r | |
724 | -#endif\r | |
725 | }\r | |
726 | \r | |
727 | void SlaOutputDev::startPage(int pageNum, GfxState *, XRef *)\r | |
728 | diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h | |
729 | index 02e5382534..601e287451 100644 | |
730 | --- a/scribus/plugins/import/pdf/slaoutput.h | |
731 | +++ b/scribus/plugins/import/pdf/slaoutput.h | |
732 | @@ -30,9 +30,6 @@ for which a new license (GPL+exception) is in place. | |
733 | #include "selection.h"\r | |
734 | #include "vgradient.h"\r | |
735 | \r | |
736 | -#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 73, 0)\r | |
737 | -#include <poppler/goo/gtypes.h>\r | |
738 | -#endif\r | |
739 | #include <poppler/Object.h>\r | |
740 | #include <poppler/OutputDev.h>\r | |
741 | #include <poppler/Gfx.h>\r | |
742 | @@ -163,11 +160,7 @@ class SlaOutputDev : public OutputDev | |
743 | virtual ~SlaOutputDev();\r | |
744 | \r | |
745 | LinkAction* SC_getAction(AnnotWidget *ano);\r | |
746 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)\r | |
747 | std::unique_ptr<LinkAction> SC_getAdditionalAction(const char *key, AnnotWidget *ano);\r | |
748 | -#else\r | |
749 | - LinkAction* SC_getAdditionalAction(const char *key, AnnotWidget *ano);\r | |
750 | -#endif\r | |
751 | static GBool annotations_callback(Annot *annota, void *user_data);\r | |
752 | bool handleTextAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);\r | |
753 | bool handleLinkAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);\r | |
754 | diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp | |
755 | index e20a81f99e..5626fe3477 100644 | |
756 | --- a/scribus/plugins/import/pdf/slaoutput.cpp | |
757 | +++ b/scribus/plugins/import/pdf/slaoutput.cpp | |
758 | @@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s) | |
759 | int shade = 100;\r | |
760 | currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);\r | |
761 | fontSize = state->getFontSize();\r | |
762 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
763 | + if (state->getFont() && state->getFont()->getName())\r | |
764 | + fontName = new GooString(state->getFont()->getName().value());\r | |
765 | +#else\r | |
766 | if (state->getFont())\r | |
767 | fontName = state->getFont()->getName()->copy();\r | |
768 | +#endif\r | |
769 | itemText = s->copy();\r | |
770 | }\r | |
771 | \r | |
772 | @@ -357,7 +362,12 @@ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key | |
773 | GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)\r | |
774 | {\r | |
775 | SlaOutputDev *dev = (SlaOutputDev*)user_data;\r | |
776 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
777 | + const PDFRectangle& annotRect = annota->getRect();;\r | |
778 | + const PDFRectangle* box = &annotRect;\r | |
779 | +#else\r | |
780 | PDFRectangle *box = annota->getRect();\r | |
781 | +#endif\r | |
782 | double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX;\r | |
783 | double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;\r | |
784 | double width = box->x2 - box->x1;\r | |
785 | @@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor, | |
786 | if (apa || !achar)\r | |
787 | {\r | |
788 | AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);\r | |
789 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
790 | + const PDFRectangle& annotaRect = annota->getRect();\r | |
791 | + Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);\r | |
792 | +#else\r | |
793 | Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);\r | |
794 | +#endif\r | |
795 | ano->draw(gfx, false);\r | |
796 | if (!bgFound)\r | |
797 | m_currColorFill = annotOutDev->currColorFill;\r | |
798 | @@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties) | |
799 | \r | |
800 | void SlaOutputDev::updateFont(GfxState *state)\r | |
801 | {\r | |
802 | - GfxFont *gfxFont;\r | |
803 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
804 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
805 | + std::optional<GfxFontLoc> fontLoc;\r | |
806 | + std::string fileName;\r | |
807 | + std::unique_ptr<FoFiTrueType> ff;\r | |
808 | + std::optional<std::vector<unsigned char>> tmpBuf;\r | |
809 | +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
810 | std::optional<GfxFontLoc> fontLoc;\r | |
811 | const GooString * fileName = nullptr;\r | |
812 | std::unique_ptr<FoFiTrueType> ff;\r | |
813 | + char* tmpBuf = nullptr;\r | |
814 | #else\r | |
815 | GfxFontLoc * fontLoc = nullptr;\r | |
816 | GooString * fileName = nullptr;\r | |
817 | FoFiTrueType * ff = nullptr;\r | |
818 | + char* tmpBuf = nullptr;\r | |
819 | #endif\r | |
820 | GfxFontType fontType;\r | |
821 | SlaOutFontFileID *id;\r | |
822 | SplashFontFile *fontFile;\r | |
823 | SplashFontSrc *fontsrc = nullptr;\r | |
824 | Object refObj, strObj;\r | |
825 | - char *tmpBuf = nullptr;\r | |
826 | int tmpBufLen = 0;\r | |
827 | int *codeToGID = nullptr;\r | |
828 | const double *textMat = nullptr;\r | |
829 | @@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state) | |
830 | \r | |
831 | m_font = nullptr;\r | |
832 | \r | |
833 | - gfxFont = state->getFont();\r | |
834 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
835 | + GfxFont* gfxFont = state->getFont().get();\r | |
836 | +#else\r | |
837 | + GfxFont* gfxFont = state->getFont();\r | |
838 | +#endif\r | |
839 | if (!gfxFont)\r | |
840 | goto err1;\r | |
841 | \r | |
842 | @@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state) | |
843 | if (fontLoc->locType == gfxFontLocEmbedded)\r | |
844 | {\r | |
845 | // if there is an embedded font, read it to memory\r | |
846 | - tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);\r | |
847 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
848 | + tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef());\r | |
849 | if (! tmpBuf)\r | |
850 | goto err2;\r | |
851 | +#else\r | |
852 | + tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);\r | |
853 | + if (!tmpBuf)\r | |
854 | + goto err2;\r | |
855 | +#endif\r | |
856 | \r | |
857 | // external font\r | |
858 | }\r | |
859 | else\r | |
860 | { // gfxFontLocExternal\r | |
861 | -#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
862 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
863 | + fileName = fontLoc->path;\r | |
864 | +#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
865 | fileName = fontLoc->pathAsGooString();\r | |
866 | #else\r | |
867 | fileName = fontLoc->path;\r | |
868 | @@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state) | |
869 | }\r | |
870 | \r | |
871 | fontsrc = new SplashFontSrc;\r | |
872 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
873 | + if (!fileName.empty())\r | |
874 | + fontsrc->setFile(fileName);\r | |
875 | + else\r | |
876 | + fontsrc->setBuf(std::move(tmpBuf.value()));\r | |
877 | +#else\r | |
878 | if (fileName)\r | |
879 | fontsrc->setFile(fileName, gFalse);\r | |
880 | else\r | |
881 | fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);\r | |
882 | +#endif\r | |
883 | \r | |
884 | // load the font file\r | |
885 | switch (fontType) {\r | |
886 | case fontType1:\r | |
887 | - if (!(fontFile = m_fontEngine->loadType1Font(\r | |
888 | - id,\r | |
889 | - fontsrc,\r | |
890 | - (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r | |
891 | + if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r | |
892 | {\r | |
893 | - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
894 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
895 | + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
896 | goto err2;\r | |
897 | }\r | |
898 | break;\r | |
899 | case fontType1C:\r | |
900 | - if (!(fontFile = m_fontEngine->loadType1CFont(\r | |
901 | - id,\r | |
902 | - fontsrc,\r | |
903 | - (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r | |
904 | + if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r | |
905 | {\r | |
906 | - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
907 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
908 | + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
909 | goto err2;\r | |
910 | }\r | |
911 | break;\r | |
912 | case fontType1COT:\r | |
913 | - if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(\r | |
914 | - id,\r | |
915 | - fontsrc,\r | |
916 | - (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r | |
917 | + if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))\r | |
918 | {\r | |
919 | - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
920 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
921 | + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
922 | goto err2;\r | |
923 | }\r | |
924 | break;\r | |
925 | case fontTrueType:\r | |
926 | case fontTrueTypeOT:\r | |
927 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
928 | + if (!fileName.empty())\r | |
929 | + ff = FoFiTrueType::load(fileName.c_str());\r | |
930 | + else\r | |
931 | + ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());\r | |
932 | +#else\r | |
933 | if (fileName)\r | |
934 | ff = FoFiTrueType::load(fileName->getCString());\r | |
935 | else\r | |
936 | ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r | |
937 | +#endif\r | |
938 | if (ff)\r | |
939 | {\r | |
940 | #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
941 | @@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state) | |
942 | codeToGID = nullptr;\r | |
943 | n = 0;\r | |
944 | }\r | |
945 | - if (!(fontFile = m_fontEngine->loadTrueTypeFont(\r | |
946 | - id,\r | |
947 | - fontsrc,\r | |
948 | - codeToGID, n)))\r | |
949 | + if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n)))\r | |
950 | {\r | |
951 | - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
952 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
953 | + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
954 | goto err2;\r | |
955 | }\r | |
956 | break;\r | |
957 | case fontCIDType0:\r | |
958 | case fontCIDType0C:\r | |
959 | - if (!(fontFile = m_fontEngine->loadCIDFont(\r | |
960 | - id,\r | |
961 | - fontsrc)))\r | |
962 | + if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))\r | |
963 | {\r | |
964 | - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
965 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
966 | + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
967 | goto err2;\r | |
968 | }\r | |
969 | break;\r | |
970 | @@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state) | |
971 | codeToGID = nullptr;\r | |
972 | n = 0;\r | |
973 | }\r | |
974 | - if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(\r | |
975 | - id,\r | |
976 | - fontsrc,\r | |
977 | - codeToGID, n)))\r | |
978 | + if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n)))\r | |
979 | {\r | |
980 | error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
981 | gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
982 | @@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state) | |
983 | }\r | |
984 | else\r | |
985 | {\r | |
986 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
987 | + if (!fileName.empty())\r | |
988 | + ff = FoFiTrueType::load(fileName.c_str());\r | |
989 | + else\r | |
990 | + ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());\r | |
991 | +#else\r | |
992 | if (fileName)\r | |
993 | ff = FoFiTrueType::load(fileName->getCString());\r | |
994 | else\r | |
995 | ff = FoFiTrueType::make(tmpBuf, tmpBufLen);\r | |
996 | +#endif\r | |
997 | if (! ff)\r | |
998 | goto err2;\r | |
999 | #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)\r | |
1000 | @@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state) | |
1001 | delete ff;\r | |
1002 | #endif\r | |
1003 | }\r | |
1004 | - if (!(fontFile = m_fontEngine->loadTrueTypeFont(\r | |
1005 | - id,\r | |
1006 | - fontsrc,\r | |
1007 | - codeToGID, n, faceIndex)))\r | |
1008 | + if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex)))\r | |
1009 | {\r | |
1010 | - error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",\r | |
1011 | - gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
1012 | + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");\r | |
1013 | goto err2;\r | |
1014 | }\r | |
1015 | break;\r | |
1016 | @@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub | |
1017 | GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen)\r | |
1018 | {\r | |
1019 | // qDebug() << "beginType3Char";\r | |
1020 | +#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)\r | |
1021 | GfxFont *gfxFont;\r | |
1022 | + if (!(gfxFont = state->getFont().get()))\r | |
1023 | + return gTrue;\r | |
1024 | +#else\r | |
1025 | + GfxFont* gfxFont;\r | |
1026 | if (!(gfxFont = state->getFont()))\r | |
1027 | return gTrue;\r | |
1028 | +#endif\r | |
1029 | if (gfxFont->getType() != fontType3)\r | |
1030 | return gTrue;\r | |
1031 | F3Entry f3e;\r |