From nobody Tue Apr 26 17:07:58 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3A3D81AAC133; Tue, 26 Apr 2022 17:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KnpH25jpmz4s3k; Tue, 26 Apr 2022 17:07:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650992878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xRSPge3FzT0KpZTh2cqWE4dB3J0ow2ibAaAWC4UqtEc=; b=R0I7wfBFiMT8bmPJibADU1obRRZg8m7+3Eu76MM+u4K1GlVozFBlTAD9GVQ4K5Qvlh8Set epG3bCOzBXk7skyANXq+QIEUBBARejSTJRCr3uzV9rnUFcCqeubU7oQo1SIU5js8eESxfT NCG3nKRpsEmTuTd0Rx+l2dPXG6NASVZo76+ptm22Zsz5xHQKewBEhRZESFjxnCIDbgDFtD VgSW3nvSvefUpyH8YrxwbLgjqbk9ETGpUQ81jU/1j9x1qiKI7Zs8wUNTQ4EjEU+67R41Je k7wT4gvKttAU7aS74hxo2aqTuccjg/cvzK6gCKPaURB7Or/WijG7JFfBW7zvHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8532E13731; Tue, 26 Apr 2022 17:07:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23QH7weg007118; Tue, 26 Apr 2022 17:07:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23QH7wdc007117; Tue, 26 Apr 2022 17:07:58 GMT (envelope-from git) Date: Tue, 26 Apr 2022 17:07:58 GMT Message-Id: <202204261707.23QH7wdc007117@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Tobias C. Berner" Subject: git: cd7cafb89b7a - main - print/scribus: prepare for update of graphics/poppler List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tcberner X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd7cafb89b7a7df625ede5c75b1686b118828f45 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650992878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xRSPge3FzT0KpZTh2cqWE4dB3J0ow2ibAaAWC4UqtEc=; b=eEroZbZwI3DGIt5lVWKI9EQbZW1RudZtn5PC+7+r2tgbK5KgFOcjQ2JIt51myOuwraqHTN ULaA/UNh/NLO8SyDfvIDBRrELl1+Bd3F9T6V+oa0EkX53Yziz0NRs8SuNfqYg62/ma07M6 XEY+ybeBQ30c6hIRJlMwn5HBG3Xy/QpeYjDMYFACwH0hQ8fs7S0eKmk7pli043P2nlUlIH EzUGgOcfZumyUy5JZ/YqSEg3qyIglWtJ0hQ0X7O9KuvTnXZ+4Rp91PhMjsvfj/zpwqKUcY uPUn6z/mm5sLUKLqoUhsm4+mTCaVhmQtkLQephmhSCITM3Fio07CZ4DVdhSrQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650992878; a=rsa-sha256; cv=none; b=LT8ucEfqE0vMIJTpeOEEFbYcUXN4aMhJMXwUtrRNKtKvVLlX+mZG96tWPBOAzszfarCfeM 4OrvvfNHO3Uwfl14GAK1RU4BW9rRekmslio24Wi4lWR8kYmwtEaLR638NS7F8kOSYJtYLV qzG3oT174lNRRyG/yPxPqRgVUnrZuOj0Tbd3wHkcRR5xUrSjQxhZotCjIpixMS3KbDGTzK A58GNuoCjxqWuQkGIymaqSaTj54tEBek2fkMrEZH5ht1q3LLuI9Dx3+y03T4EvC6QR9SCr 0CHaOnEZsAGGYUGmMz5rIUDbF7EUun+3Mb08pSMDcd5trrhJ5cF5FAGWqfESzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tcberner: URL: https://cgit.FreeBSD.org/ports/commit/?id=cd7cafb89b7a7df625ede5c75b1686b118828f45 commit cd7cafb89b7a7df625ede5c75b1686b118828f45 Author: Tobias C. Berner AuthorDate: 2022-04-26 12:17:37 +0000 Commit: Tobias C. Berner CommitDate: 2022-04-26 16:50:53 +0000 print/scribus: prepare for update of graphics/poppler Patches obtained from KaOSx Linux: https://github.com/KaOSx/apps/blob/master/scribus/PKGBUILD PR: 263009 --- .../files/patch-kaos-poppler-22.02.0_1 | 119 +++++++++ .../files/patch-kaos-poppler-22.02.0_2 | 18 ++ .../scribus-devel/files/patch-kaos-poppler-22.03.0 | 42 ++++ .../scribus-devel/files/patch-kaos-poppler-22.04.0 | 278 +++++++++++++++++++++ 4 files changed, 457 insertions(+) diff --git a/print/scribus-devel/files/patch-kaos-poppler-22.02.0_1 b/print/scribus-devel/files/patch-kaos-poppler-22.02.0_1 new file mode 100644 index 000000000000..14c2e381582e --- /dev/null +++ b/print/scribus-devel/files/patch-kaos-poppler-22.02.0_1 @@ -0,0 +1,119 @@ +diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp +index 5894bf2ad6..3650c96f52 100644 +--- scribus/plugins/import/pdf/slaoutput.cpp ++++ scribus/plugins/import/pdf/slaoutput.cpp +@@ -7,6 +7,11 @@ for which a new license (GPL+exception) is in place. + + #include "slaoutput.h" + ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) ++#include ++#include ++#endif ++ + #include + #include + #include +@@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties) + void SlaOutputDev::updateFont(GfxState *state) + { + GfxFont *gfxFont; +- GfxFontLoc *fontLoc; ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) ++ std::optional fontLoc; ++ const GooString * fileName = nullptr; ++ std::unique_ptr 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 @@ void SlaOutputDev::updateFont(GfxState *state) + SplashCoord matrix[6]; + + m_font = nullptr; +- fileName = nullptr; +- tmpBuf = nullptr; +- fontLoc = nullptr; + + gfxFont = state->getFont(); + if (!gfxFont) +@@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state) + } + 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 @@ void SlaOutputDev::updateFont(GfxState *state) + 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); +- n = 256; + delete ff; ++#endif ++ n = 256; + } + else + { +@@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state) + 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 @@ void SlaOutputDev::updateFont(GfxState *state) + 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(); diff --git a/print/scribus-devel/files/patch-kaos-poppler-22.02.0_2 b/print/scribus-devel/files/patch-kaos-poppler-22.02.0_2 new file mode 100644 index 000000000000..eb06789716d2 --- /dev/null +++ b/print/scribus-devel/files/patch-kaos-poppler-22.02.0_2 @@ -0,0 +1,18 @@ +diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp +index 3650c96f52..a6f4e00fa9 100644 +--- scribus/plugins/import/pdf/slaoutput.cpp ++++ scribus/plugins/import/pdf/slaoutput.cpp +@@ -3072,10 +3072,10 @@ void SlaOutputDev::updateFont(GfxState *state) + delete id; + else + { +- if (!(fontLoc = gfxFont->locateFont(xref, nullptr))) ++ fontLoc = gfxFont->locateFont((xref) ? xref : pdfDoc->getXRef(), nullptr); ++ if (!fontLoc) + { +- error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + diff --git a/print/scribus-devel/files/patch-kaos-poppler-22.03.0 b/print/scribus-devel/files/patch-kaos-poppler-22.03.0 new file mode 100644 index 000000000000..810a20726565 --- /dev/null +++ b/print/scribus-devel/files/patch-kaos-poppler-22.03.0 @@ -0,0 +1,42 @@ +diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp +index 154e58a3f0..392dcd9e64 100644 +--- scribus/plugins/import/pdf/importpdf.cpp ++++ scribus/plugins/import/pdf/importpdf.cpp +@@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName) + #endif + globalParams->setErrQuiet(gTrue); + ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0) ++ PDFDoc pdfDoc{ std::make_unique(fname) }; ++#else + PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr}; ++#endif + if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted) + return QImage(); + +@@ -342,7 +346,11 @@ bool PdfPlug::convert(const QString& fn) + globalParams->setErrQuiet(gTrue); + // globalParams->setPrintCommands(gTrue); + QList ocgGroups; ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0) ++ auto pdfDoc = std::make_unique(std::make_unique(fname)); ++#else + auto pdfDoc = std::unique_ptr(new PDFDoc(fname, nullptr, nullptr, nullptr)); ++#endif + if (pdfDoc) + { + if (pdfDoc->getErrorCode() == errEncrypted) +@@ -361,8 +369,13 @@ bool PdfPlug::convert(const QString& fn) + #else + auto fname = new GooString(QFile::encodeName(fn).data()); + #endif ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0) ++ std::optional userPW(std::in_place, text.toLocal8Bit().data()); ++ pdfDoc.reset(new PDFDoc(std::make_unique(fname), userPW, userPW, nullptr)); ++#else + auto userPW = new GooString(text.toLocal8Bit().data()); + pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr)); ++#endif + qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); + } + if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone)) diff --git a/print/scribus-devel/files/patch-kaos-poppler-22.04.0 b/print/scribus-devel/files/patch-kaos-poppler-22.04.0 new file mode 100644 index 000000000000..19d0e761367c --- /dev/null +++ b/print/scribus-devel/files/patch-kaos-poppler-22.04.0 @@ -0,0 +1,278 @@ +diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp +index e20a81f99e..5626fe3477 100644 +--- scribus/plugins/import/pdf/slaoutput.cpp ++++ scribus/plugins/import/pdf/slaoutput.cpp +@@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s) + int shade = 100; + currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade); + fontSize = state->getFontSize(); ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ if (state->getFont() && state->getFont()->getName()) ++ fontName = new GooString(state->getFont()->getName().value()); ++#else + if (state->getFont()) + fontName = state->getFont()->getName()->copy(); ++#endif + itemText = s->copy(); + } + +@@ -357,7 +362,12 @@ std::unique_ptr SlaOutputDev::SC_getAdditionalAction(const char *key + GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data) + { + SlaOutputDev *dev = (SlaOutputDev*)user_data; ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ const PDFRectangle& annotRect = annota->getRect();; ++ const PDFRectangle* box = &annotRect; ++#else + PDFRectangle *box = annota->getRect(); ++#endif + double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX; + double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY; + double width = box->x2 - box->x1; +@@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor, + if (apa || !achar) + { + AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors); ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ const PDFRectangle& annotaRect = annota->getRect(); ++ Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr); ++#else + Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr); ++#endif + ano->draw(gfx, false); + if (!bgFound) + m_currColorFill = annotOutDev->currColorFill; +@@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties) + + void SlaOutputDev::updateFont(GfxState *state) + { +- GfxFont *gfxFont; +-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ std::optional fontLoc; ++ std::string fileName; ++ std::unique_ptr ff; ++ std::optional> tmpBuf; ++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) + std::optional fontLoc; + const GooString * fileName = nullptr; + std::unique_ptr ff; ++ char* tmpBuf = nullptr; + #else + GfxFontLoc * fontLoc = nullptr; + GooString * fileName = nullptr; + FoFiTrueType * ff = nullptr; ++ char* tmpBuf = nullptr; + #endif + GfxFontType fontType; + SlaOutFontFileID *id; + SplashFontFile *fontFile; + SplashFontSrc *fontsrc = nullptr; + Object refObj, strObj; +- char *tmpBuf = nullptr; + int tmpBufLen = 0; + int *codeToGID = nullptr; + const double *textMat = nullptr; +@@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state) + + m_font = nullptr; + +- gfxFont = state->getFont(); ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ GfxFont* gfxFont = state->getFont().get(); ++#else ++ GfxFont* gfxFont = state->getFont(); ++#endif + if (!gfxFont) + goto err1; + +@@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state) + if (fontLoc->locType == gfxFontLocEmbedded) + { + // if there is an embedded font, read it to memory +- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen); ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef()); + if (! tmpBuf) + goto err2; ++#else ++ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen); ++ if (!tmpBuf) ++ goto err2; ++#endif + + // external font + } + else + { // gfxFontLocExternal +-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ fileName = fontLoc->path; ++#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) + fileName = fontLoc->pathAsGooString(); + #else + fileName = fontLoc->path; +@@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state) + } + + fontsrc = new SplashFontSrc; ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ if (!fileName.empty()) ++ fontsrc->setFile(fileName); ++ else ++ fontsrc->setBuf(std::move(tmpBuf.value())); ++#else + if (fileName) + fontsrc->setFile(fileName, gFalse); + else + fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue); ++#endif + + // load the font file + switch (fontType) { + case fontType1: +- if (!(fontFile = m_fontEngine->loadType1Font( +- id, +- fontsrc, +- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding()))) ++ if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding()))) + { +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + break; + case fontType1C: +- if (!(fontFile = m_fontEngine->loadType1CFont( +- id, +- fontsrc, +- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding()))) ++ if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding()))) + { +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + break; + case fontType1COT: +- if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont( +- id, +- fontsrc, +- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding()))) ++ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding()))) + { +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + break; + case fontTrueType: + case fontTrueTypeOT: ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ if (!fileName.empty()) ++ ff = FoFiTrueType::load(fileName.c_str()); ++ else ++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size()); ++#else + if (fileName) + ff = FoFiTrueType::load(fileName->getCString()); + else + ff = FoFiTrueType::make(tmpBuf, tmpBufLen); ++#endif + if (ff) + { + #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) +@@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state) + codeToGID = nullptr; + n = 0; + } +- if (!(fontFile = m_fontEngine->loadTrueTypeFont( +- id, +- fontsrc, +- codeToGID, n))) ++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n))) + { +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + break; + case fontCIDType0: + case fontCIDType0C: +- if (!(fontFile = m_fontEngine->loadCIDFont( +- id, +- fontsrc))) ++ if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc))) + { +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + break; +@@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state) + codeToGID = nullptr; + n = 0; + } +- if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont( +- id, +- fontsrc, +- codeToGID, n))) ++ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n))) + { + error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", + gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); +@@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state) + } + else + { ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) ++ if (!fileName.empty()) ++ ff = FoFiTrueType::load(fileName.c_str()); ++ else ++ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size()); ++#else + if (fileName) + ff = FoFiTrueType::load(fileName->getCString()); + else + ff = FoFiTrueType::make(tmpBuf, tmpBufLen); ++#endif + if (! ff) + goto err2; + #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0) +@@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state) + delete ff; + #endif + } +- if (!(fontFile = m_fontEngine->loadTrueTypeFont( +- id, +- fontsrc, +- codeToGID, n, faceIndex))) ++ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex))) + { +- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", +- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); ++ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)"); + goto err2; + } + break; +@@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub + GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen) + { + // qDebug() << "beginType3Char"; ++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0) + GfxFont *gfxFont; ++ if (!(gfxFont = state->getFont().get())) ++ return gTrue; ++#else ++ GfxFont* gfxFont; + if (!(gfxFont = state->getFont())) + return gTrue; ++#endif + if (gfxFont->getType() != fontType3) + return gTrue; + F3Entry f3e;