poppler/CairoFontEngine.cc | 28 ++++++++++++++-------------- poppler/GfxFont.cc | 16 ++++++++-------- poppler/GfxFont.h | 2 +- poppler/PSOutputDev.cc | 36 ++++++++++++++++++------------------ poppler/SplashOutputDev.cc | 6 +++--- qt5/src/QPainterOutputDev.cc | 18 +++++++++--------- qt6/src/QPainterOutputDev.cc | 18 +++++++++--------- 7 files changed, 62 insertions(+), 62 deletions(-)
New commits: commit d72c22caf28cbe8cf1e268f8ff741d7e1330df63 Author: Albert Astals Cid <[email protected]> Date: Sat Mar 26 23:16:51 2022 +0100 Fix regression caused by a6b2442e37cc00534bcdca7c83366a0fa0501157 File regressed is https://bugs.freedesktop.org/attachment.cgi?id=118361 The old code did different things in nullptr compared to empty buffer so we need to have the same semantics, use an optional for that diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 19beb6ea..0f80a205 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -281,7 +281,7 @@ CairoFreeTypeFont::~CairoFreeTypeFont() { } CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Library lib, bool useCIDs) { const char *fileNameC; - std::vector<unsigned char> font_data; + std::optional<std::vector<unsigned char>> font_data; int i, n; GfxFontType fontType; std::optional<GfxFontLoc> fontLoc; @@ -315,7 +315,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li // embedded font if (fontLoc->locType == gfxFontLocEmbedded) { font_data = gfxFont->readEmbFontFile(xref); - if (font_data.empty()) { + if (!font_data) { goto err2; } @@ -334,7 +334,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li case fontType1: case fontType1C: case fontType1COT: - if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data), &face, &font_face)) { + if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data.value()), &face, &font_face)) { error(errSyntaxError, -1, "could not create type1 face"); goto err2; } @@ -373,8 +373,8 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li } } else { std::unique_ptr<FoFiTrueType> ff; - if (!font_data.empty()) { - ff = FoFiTrueType::make(font_data.data(), font_data.size()); + if (font_data) { + ff = FoFiTrueType::make(font_data->data(), font_data->size()); } else { ff = FoFiTrueType::load(fileNameC); } @@ -388,8 +388,8 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li case fontTrueType: case fontTrueTypeOT: { std::unique_ptr<FoFiTrueType> ff; - if (!font_data.empty()) { - ff = FoFiTrueType::make(font_data.data(), font_data.size()); + if (font_data) { + ff = FoFiTrueType::make(font_data->data(), font_data->size()); } else { ff = FoFiTrueType::load(fileNameC); } @@ -402,7 +402,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff.get()); codeToGIDLen = 256; } - if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data), &face, &font_face)) { + if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data.value()), &face, &font_face)) { error(errSyntaxError, -1, "could not create truetype face\n"); goto err2; } @@ -415,8 +415,8 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li codeToGIDLen = 0; if (!useCIDs) { - if (!font_data.empty()) { - ff1c = FoFiType1C::make(font_data.data(), font_data.size()); + if (font_data) { + ff1c = FoFiType1C::make(font_data->data(), font_data->size()); } else { ff1c = FoFiType1C::load(fileNameC); } @@ -426,7 +426,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li } } - if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data), &face, &font_face)) { + if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data.value()), &face, &font_face)) { error(errSyntaxError, -1, "could not create cid face\n"); goto err2; } @@ -447,8 +447,8 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li if (!codeToGID) { if (!useCIDs) { std::unique_ptr<FoFiTrueType> ff; - if (!font_data.empty()) { - ff = FoFiTrueType::make(font_data.data(), font_data.size()); + if (font_data) { + ff = FoFiTrueType::make(font_data->data(), font_data->size()); } else { ff = FoFiTrueType::load(fileNameC); } @@ -459,7 +459,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li } } } - if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data), &face, &font_face)) { + if (!_ft_new_face(lib, fileNameC, embFontID, std::move(font_data.value()), &face, &font_face)) { error(errSyntaxError, -1, "could not create cid (OT) face\n"); goto err2; } diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index e630cf06..16a62c43 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -819,7 +819,7 @@ std::optional<GfxFontLoc> GfxFont::getExternalFont(GooString *path, bool cid) return std::move(fontLoc); // std::move only required to please g++-7 } -std::vector<unsigned char> GfxFont::readEmbFontFile(XRef *xref) +std::optional<std::vector<unsigned char>> GfxFont::readEmbFontFile(XRef *xref) { Stream *str; @@ -828,7 +828,7 @@ std::vector<unsigned char> GfxFont::readEmbFontFile(XRef *xref) if (!obj2.isStream()) { error(errSyntaxError, -1, "Embedded font file is not a stream"); embFontID = Ref::INVALID(); - return std::vector<unsigned char> {}; + return {}; } str = obj2.getStream(); @@ -1124,9 +1124,9 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA ffT1 = nullptr; ffT1C = nullptr; if (type == fontType1 && embFontID != Ref::INVALID()) { - const std::vector<unsigned char> buf = readEmbFontFile(xref); - if (!buf.empty()) { - if ((ffT1 = FoFiType1::make(buf.data(), buf.size()))) { + const std::optional<std::vector<unsigned char>> buf = readEmbFontFile(xref); + if (buf) { + if ((ffT1 = FoFiType1::make(buf->data(), buf->size()))) { if (ffT1->getName()) { if (embFontName) { delete embFontName; @@ -1140,9 +1140,9 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA } } } else if (type == fontType1C && embFontID != Ref::INVALID()) { - const std::vector<unsigned char> buf = readEmbFontFile(xref); - if (!buf.empty()) { - if ((ffT1C = FoFiType1C::make(buf.data(), buf.size()))) { + const std::optional<std::vector<unsigned char>> buf = readEmbFontFile(xref); + if (buf) { + if ((ffT1C = FoFiType1C::make(buf->data(), buf->size()))) { if (ffT1C->getName()) { if (embFontName) { delete embFontName; diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h index 0409680f..61aa09ae 100644 --- a/poppler/GfxFont.h +++ b/poppler/GfxFont.h @@ -279,7 +279,7 @@ public: std::optional<GfxFontLoc> locateFont(XRef *xref, PSOutputDev *ps); // Read an external or embedded font file into a buffer. - std::vector<unsigned char> readEmbFontFile(XRef *xref); + std::optional<std::vector<unsigned char>> readEmbFontFile(XRef *xref); // Get the next char from a string <s> of <len> bytes, returning the // char <code>, its Unicode mapping <u>, its displacement vector diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index effba6b1..7bfb2a00 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -2395,9 +2395,9 @@ void PSOutputDev::setupEmbeddedType1CFont(GfxFont *font, Ref *id, GooString *psN embFontList->append("\n"); // convert it to a Type 1 font - const std::vector<unsigned char> fontBuf = font->readEmbFontFile(xref); - if (!fontBuf.empty()) { - if ((ffT1C = FoFiType1C::make(fontBuf.data(), fontBuf.size()))) { + const std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { + if ((ffT1C = FoFiType1C::make(fontBuf->data(), fontBuf->size()))) { ffT1C->convertToType1(psName->c_str(), nullptr, true, outputFunc, outputStream); delete ffT1C; } @@ -2434,9 +2434,9 @@ void PSOutputDev::setupEmbeddedOpenTypeT1CFont(GfxFont *font, Ref *id, GooString embFontList->append("\n"); // convert it to a Type 1 font - const std::vector<unsigned char> fontBuf = font->readEmbFontFile(xref); - if (!fontBuf.empty()) { - if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf.data(), fontBuf.size())) { + const std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { + if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf->data(), fontBuf->size())) { if (ffTT->isOpenTypeCFF()) { ffTT->convertToType1(psName->c_str(), nullptr, true, outputFunc, outputStream); } @@ -2458,9 +2458,9 @@ void PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, GooString *p embFontList->append("\n"); // convert it to a Type 42 font - const std::vector<unsigned char> fontBuf = font->readEmbFontFile(xref); - if (!fontBuf.empty()) { - if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf.data(), fontBuf.size())) { + const std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { + if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf->data(), fontBuf->size())) { codeToGID = ((Gfx8BitFont *)font)->getCodeToGIDMap(ffTT.get()); ffTT->convertToType42(psName->c_str(), ((Gfx8BitFont *)font)->getHasEncoding() ? ((Gfx8BitFont *)font)->getEncoding() : nullptr, codeToGID, outputFunc, outputStream); if (codeToGID) { @@ -2595,9 +2595,9 @@ void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, GooString *p embFontList->append("\n"); // convert it to a Type 0 font - const std::vector<unsigned char> fontBuf = font->readEmbFontFile(xref); - if (!fontBuf.empty()) { - if ((ffT1C = FoFiType1C::make(fontBuf.data(), fontBuf.size()))) { + const std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { + if ((ffT1C = FoFiType1C::make(fontBuf->data(), fontBuf->size()))) { if (level >= psLevel3) { // Level 3: use a CID font ffT1C->convertToCIDType0(psName->c_str(), nullptr, 0, outputFunc, outputStream); @@ -2622,9 +2622,9 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, GooString embFontList->append("\n"); // convert it to a Type 0 font - const std::vector<unsigned char> fontBuf = font->readEmbFontFile(xref); - if (!fontBuf.empty()) { - if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf.data(), fontBuf.size())) { + const std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { + if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf->data(), fontBuf->size())) { if (level >= psLevel3) { // Level 3: use a CID font ffTT->convertToCIDType2(psName->c_str(), ((GfxCIDFont *)font)->getCIDToGID(), ((GfxCIDFont *)font)->getCIDToGIDLen(), needVerticalMetrics, outputFunc, outputStream); @@ -2668,9 +2668,9 @@ void PSOutputDev::setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id, GooString embFontList->append("\n"); // convert it to a Type 0 font - const std::vector<unsigned char> fontBuf = font->readEmbFontFile(xref); - if (!fontBuf.empty()) { - if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf.data(), fontBuf.size())) { + const std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { + if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(fontBuf->data(), fontBuf->size())) { if (ffTT->isOpenTypeCFF()) { if (level >= psLevel3) { // Level 3: use a CID font diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 8ff7b9a4..695f867a 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -1892,12 +1892,12 @@ reload: // embedded font std::string fileName; - std::vector<unsigned char> tmpBuf; + std::optional<std::vector<unsigned char>> tmpBuf; if (fontLoc->locType == gfxFontLocEmbedded) { // if there is an embedded font, read it to memory tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : doc->getXRef()); - if (tmpBuf.empty()) { + if (!tmpBuf) { goto err2; } @@ -1912,7 +1912,7 @@ reload: if (!fileName.empty()) { fontsrc->setFile(fileName); } else { - fontsrc->setBuf(std::move(tmpBuf)); + fontsrc->setBuf(std::move(tmpBuf.value())); } // load the font file diff --git a/qt5/src/QPainterOutputDev.cc b/qt5/src/QPainterOutputDev.cc index 4c9b5306..b68c0756 100644 --- a/qt5/src/QPainterOutputDev.cc +++ b/qt5/src/QPainterOutputDev.cc @@ -462,10 +462,10 @@ void QPainterOutputDev::updateFont(GfxState *state) // load the font from respective location switch (fontLoc->locType) { case gfxFontLocEmbedded: { // if there is an embedded font, read it to memory - const std::vector<unsigned char> fontData = gfxFont->readEmbFontFile(xref); + const std::optional<std::vector<unsigned char>> fontData = gfxFont->readEmbFontFile(xref); // fontData gets copied in the QByteArray constructor - m_rawFont = new QRawFont(QByteArray((const char *)fontData.data(), fontData.size()), fontSize, m_hintingPreference); + m_rawFont = new QRawFont(QByteArray(fontData ? (const char *)fontData->data() : nullptr, fontData ? fontData->size() : 0), fontSize, m_hintingPreference); m_rawFontCache.insert(std::make_pair(fontID, std::unique_ptr<QRawFont>(m_rawFont))); break; @@ -519,7 +519,7 @@ void QPainterOutputDev::updateFont(GfxState *state) } else { - std::vector<unsigned char> fontBuffer; + std::optional<std::vector<unsigned char>> fontBuffer; std::optional<GfxFontLoc> fontLoc = gfxFont->locateFont(xref, nullptr); if (!fontLoc) { @@ -531,7 +531,7 @@ void QPainterOutputDev::updateFont(GfxState *state) if (fontLoc->locType == gfxFontLocEmbedded) { // if there is an embedded font, read it to memory fontBuffer = gfxFont->readEmbFontFile(xref); - if (fontBuffer.empty()) { + if (!fontBuffer) { return; } @@ -556,7 +556,7 @@ void QPainterOutputDev::updateFont(GfxState *state) return; } } else { - if (FT_New_Memory_Face(m_ftLibrary, (const FT_Byte *)fontBuffer.data(), fontBuffer.size(), faceIndex, &freeTypeFace)) { + if (FT_New_Memory_Face(m_ftLibrary, (const FT_Byte *)fontBuffer->data(), fontBuffer->size(), faceIndex, &freeTypeFace)) { error(errSyntaxError, -1, "Couldn't create a FreeType face for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); return; } @@ -586,7 +586,7 @@ void QPainterOutputDev::updateFont(GfxState *state) } case fontTrueType: case fontTrueTypeOT: { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer.data(), fontBuffer.size()); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer->data(), fontBuffer->size()); m_codeToGIDCache[id] = (ff) ? ((Gfx8BitFont *)gfxFont.get())->getCodeToGIDMap(ff.get()) : nullptr; @@ -599,7 +599,7 @@ void QPainterOutputDev::updateFont(GfxState *state) // check for a CFF font if (!m_useCIDs) { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? std::unique_ptr<FoFiType1C>(FoFiType1C::load(fontLoc->path.c_str())) : std::unique_ptr<FoFiType1C>(FoFiType1C::make(fontBuffer.data(), fontBuffer.size())); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? std::unique_ptr<FoFiType1C>(FoFiType1C::load(fontLoc->path.c_str())) : std::unique_ptr<FoFiType1C>(FoFiType1C::make(fontBuffer->data(), fontBuffer->size())); cidToGIDMap = (ff) ? ff->getCIDToGIDMap(&nCIDs) : nullptr; } @@ -621,7 +621,7 @@ void QPainterOutputDev::updateFont(GfxState *state) int nCIDs = 0; if (!codeToGID && !m_useCIDs) { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer.data(), fontBuffer.size()); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer->data(), fontBuffer->size()); if (ff && ff->isOpenTypeCFF()) { cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); @@ -643,7 +643,7 @@ void QPainterOutputDev::updateFont(GfxState *state) memcpy(codeToGID, ((GfxCIDFont *)gfxFont.get())->getCIDToGID(), codeToGIDLen * sizeof(int)); } } else { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer.data(), fontBuffer.size()); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer->data(), fontBuffer->size()); if (!ff) { return; } diff --git a/qt6/src/QPainterOutputDev.cc b/qt6/src/QPainterOutputDev.cc index 4c9b5306..b68c0756 100644 --- a/qt6/src/QPainterOutputDev.cc +++ b/qt6/src/QPainterOutputDev.cc @@ -462,10 +462,10 @@ void QPainterOutputDev::updateFont(GfxState *state) // load the font from respective location switch (fontLoc->locType) { case gfxFontLocEmbedded: { // if there is an embedded font, read it to memory - const std::vector<unsigned char> fontData = gfxFont->readEmbFontFile(xref); + const std::optional<std::vector<unsigned char>> fontData = gfxFont->readEmbFontFile(xref); // fontData gets copied in the QByteArray constructor - m_rawFont = new QRawFont(QByteArray((const char *)fontData.data(), fontData.size()), fontSize, m_hintingPreference); + m_rawFont = new QRawFont(QByteArray(fontData ? (const char *)fontData->data() : nullptr, fontData ? fontData->size() : 0), fontSize, m_hintingPreference); m_rawFontCache.insert(std::make_pair(fontID, std::unique_ptr<QRawFont>(m_rawFont))); break; @@ -519,7 +519,7 @@ void QPainterOutputDev::updateFont(GfxState *state) } else { - std::vector<unsigned char> fontBuffer; + std::optional<std::vector<unsigned char>> fontBuffer; std::optional<GfxFontLoc> fontLoc = gfxFont->locateFont(xref, nullptr); if (!fontLoc) { @@ -531,7 +531,7 @@ void QPainterOutputDev::updateFont(GfxState *state) if (fontLoc->locType == gfxFontLocEmbedded) { // if there is an embedded font, read it to memory fontBuffer = gfxFont->readEmbFontFile(xref); - if (fontBuffer.empty()) { + if (!fontBuffer) { return; } @@ -556,7 +556,7 @@ void QPainterOutputDev::updateFont(GfxState *state) return; } } else { - if (FT_New_Memory_Face(m_ftLibrary, (const FT_Byte *)fontBuffer.data(), fontBuffer.size(), faceIndex, &freeTypeFace)) { + if (FT_New_Memory_Face(m_ftLibrary, (const FT_Byte *)fontBuffer->data(), fontBuffer->size(), faceIndex, &freeTypeFace)) { error(errSyntaxError, -1, "Couldn't create a FreeType face for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); return; } @@ -586,7 +586,7 @@ void QPainterOutputDev::updateFont(GfxState *state) } case fontTrueType: case fontTrueTypeOT: { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer.data(), fontBuffer.size()); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer->data(), fontBuffer->size()); m_codeToGIDCache[id] = (ff) ? ((Gfx8BitFont *)gfxFont.get())->getCodeToGIDMap(ff.get()) : nullptr; @@ -599,7 +599,7 @@ void QPainterOutputDev::updateFont(GfxState *state) // check for a CFF font if (!m_useCIDs) { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? std::unique_ptr<FoFiType1C>(FoFiType1C::load(fontLoc->path.c_str())) : std::unique_ptr<FoFiType1C>(FoFiType1C::make(fontBuffer.data(), fontBuffer.size())); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? std::unique_ptr<FoFiType1C>(FoFiType1C::load(fontLoc->path.c_str())) : std::unique_ptr<FoFiType1C>(FoFiType1C::make(fontBuffer->data(), fontBuffer->size())); cidToGIDMap = (ff) ? ff->getCIDToGIDMap(&nCIDs) : nullptr; } @@ -621,7 +621,7 @@ void QPainterOutputDev::updateFont(GfxState *state) int nCIDs = 0; if (!codeToGID && !m_useCIDs) { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer.data(), fontBuffer.size()); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer->data(), fontBuffer->size()); if (ff && ff->isOpenTypeCFF()) { cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); @@ -643,7 +643,7 @@ void QPainterOutputDev::updateFont(GfxState *state) memcpy(codeToGID, ((GfxCIDFont *)gfxFont.get())->getCIDToGID(), codeToGIDLen * sizeof(int)); } } else { - auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer.data(), fontBuffer.size()); + auto ff = (fontLoc->locType != gfxFontLocEmbedded) ? FoFiTrueType::load(fontLoc->path.c_str()) : FoFiTrueType::make(fontBuffer->data(), fontBuffer->size()); if (!ff) { return; }
