r24883 by jghali - #16734: Build break with poppler 22.2.0 <foutrelis>
scribus-commit
scribus-commit at lists.scribus.net
Wed Feb 2 23:12:32 UTC 2022
Author: jghali
Date: Wed Feb 2 23:12:31 2022
New Revision: 24883
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24883
Log:
#16734: Build break with poppler 22.2.0 <foutrelis>
Modified:
branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
Modified: branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24883&path=/branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Wed Feb 2 23:12:31 2022
@@ -6,6 +6,11 @@
*/
#include "slaoutput.h"
+
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+#include <memory>
+#include <optional>
+#endif
#include <poppler/GlobalParams.h>
#include <poppler/poppler-config.h>
@@ -3027,18 +3032,24 @@
void SlaOutputDev::updateFont(GfxState *state)
{
GfxFont *gfxFont;
- GfxFontLoc *fontLoc;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ std::optional<GfxFontLoc> fontLoc;
+ const GooString * fileName = nullptr;
+ std::unique_ptr<FoFiTrueType> ff;
+#else
+ GfxFontLoc * fontLoc = nullptr;
+ GooString * fileName = nullptr;
+ FoFiTrueType * ff = nullptr;
+#endif
GfxFontType fontType;
SlaOutFontFileID *id;
SplashFontFile *fontFile;
SplashFontSrc *fontsrc = nullptr;
- FoFiTrueType *ff;
Object refObj, strObj;
- GooString *fileName;
- char *tmpBuf;
+ char *tmpBuf = nullptr;
int tmpBufLen = 0;
- int *codeToGID;
- const double *textMat;
+ int *codeToGID = nullptr;
+ const double *textMat = nullptr;
double m11, m12, m21, m22, fontSize;
SplashCoord mat[4];
int n = 0;
@@ -3046,9 +3057,6 @@
SplashCoord matrix[6];
m_font = nullptr;
- fileName = nullptr;
- tmpBuf = nullptr;
- fontLoc = nullptr;
gfxFont = state->getFont();
if (!gfxFont)
@@ -3083,7 +3091,11 @@
}
else
{ // gfxFontLocExternal
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ fileName = fontLoc->pathAsGooString();
+#else
fileName = fontLoc->path;
+#endif
fontType = fontLoc->fontType;
}
@@ -3136,9 +3148,14 @@
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (ff)
{
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ codeToGID = ((Gfx8BitFont*) gfxFont)->getCodeToGIDMap(ff.get());
+ ff.reset();
+#else
codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
+ delete ff;
+#endif
n = 256;
- delete ff;
}
else
{
@@ -3209,8 +3226,13 @@
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (! ff)
goto err2;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);
+ ff.reset();
+#else
codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
delete ff;
+#endif
}
if (!(fontFile = m_fontEngine->loadTrueTypeFont(
id,
@@ -3247,14 +3269,19 @@
mat[3] = -m22;
m_font = m_fontEngine->getFont(fontFile, mat, matrix);
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
delete fontLoc;
+#endif
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
return;
err2:
delete id;
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
delete fontLoc;
+#endif
+
err1:
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
More information about the scribus-commit
mailing list