sd/qa/unit/data/pdf/ErrareHumanumEst.pdf |binary sd/qa/unit/export-tests.cxx | 24 ++++++++++++++++++++++++ svx/source/svdraw/svdpdf.cxx | 6 ++++++ 3 files changed, 30 insertions(+)
New commits: commit 10a2e4ea3df5d1314de3af5c7e93c1eac96c31ed Author: Caolán McNamara <[email protected]> AuthorDate: Mon Oct 6 12:16:22 2025 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Oct 6 13:49:18 2025 +0200 font version needs to exist and be in a non-0 fractional format Change-Id: I72420866185a890b3b2af2acf2339bad3fe0080d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191961 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sd/qa/unit/data/pdf/ErrareHumanumEst.pdf b/sd/qa/unit/data/pdf/ErrareHumanumEst.pdf new file mode 100644 index 000000000000..f27ba2ed886e Binary files /dev/null and b/sd/qa/unit/data/pdf/ErrareHumanumEst.pdf differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index d305d34bd8d5..7fc1011ba27e 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1173,6 +1173,30 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfGrayscaleImageUnderInvisibleTe CPPUNIT_ASSERT_MESSAGE("Shape should be Invisible", !bVisible); } +CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfMissingFontVersion) +{ + auto pPdfium = vcl::pdf::PDFiumLibrary::get(); + if (!pPdfium) + return; + UsePdfium aGuard; + + loadFromFile(u"pdf/ErrareHumanumEst.pdf"); + + setFilterOptions("{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}"); + saveAndReload(u"OpenDocument Drawing Flat XML"_ustr); + + const SdrPage* pPage = GetPage(1); + + const SdrObject* pObj = pPage->GetObj(0); + CPPUNIT_ASSERT(pObj); + const SdrObjGroup* pObjGroup = dynamic_cast<const SdrObjGroup*>(pObj); + CPPUNIT_ASSERT(pObjGroup); + const SdrTextObj* pTextObj = DynCastSdrTextObj(pObjGroup->GetObj(0)); + OUString sText = pTextObj->GetOutlinerParaObject()->GetTextObject().GetText(0); + // Without fix this fails to import at all + CPPUNIT_ASSERT_EQUAL(u"Errare humanum est"_ustr, sText); +} + CPPUNIT_TEST_FIXTURE(SdExportTest, testEmbeddedText) { createSdDrawDoc("objectwithtext.fodg"); diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index c4e4e839552c..f13569384fde 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -1110,6 +1110,12 @@ static bool toPfaCID(SubSetInfo& rSubSetInfo, const OUString& fileUrl, if (version.isEmpty()) version = CIDFontVersion; + if (version.isEmpty() || version.toDouble() == 0.0) + { + SAL_WARN("sd.filter", "Font version cannot be empty or 0.0"); + version = "0.001"_ostr; + } + if (!brokenFontName.isEmpty()) FontName = postScriptName.toUtf8();
