sd/qa/unit/data/pdf/sciencejournalsource.pdf |binary sd/qa/unit/export-tests.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
New commits: commit a94c3a961eeba79c025fc42340c6eb1cf836d68e Author: Caolán McNamara <[email protected]> AuthorDate: Wed Oct 15 13:51:04 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 26 12:06:19 2025 +0100 add test that font was extracted and embedded Change-Id: I1294dfaa43cb357b15b408ca9b0c7ed55db122ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192453 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/qa/unit/data/pdf/sciencejournalsource.pdf b/sd/qa/unit/data/pdf/sciencejournalsource.pdf new file mode 100644 index 000000000000..3863fd6d28c1 Binary files /dev/null and b/sd/qa/unit/data/pdf/sciencejournalsource.pdf differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 1f6ebf9f8d28..66d9e1cfbc57 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1210,6 +1210,31 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfMissingFontVersion) CPPUNIT_ASSERT_EQUAL(u"Errare humanum est"_ustr, sText); } +CPPUNIT_TEST_FIXTURE(SdExportTest, testExplodedPdfEmbeddedFonts) +{ + auto pPdfium = vcl::pdf::PDFiumLibrary::get(); + if (!pPdfium) + return; + UsePdfium aGuard; + + //cannot overwrite font file that windows has already open, fix in a later + //patch +#if !defined _WIN32 + loadFromFile(u"pdf/sciencejournalsource.pdf"); + + setFilterOptions("{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}"); + save(u"OpenDocument Drawing Flat XML"_ustr); + + xmlDocUniquePtr pXmlDoc = parseExportedFile(); + + // The PT Serif embedded font should have been extracted and embedded into the fodg, + // ensure we have the bold variant + assertXPath(pXmlDoc, "/office:document/office:font-face-decls/style:font-face[@style:name='PT " + "Serif']/svg:font-face-src/svg:font-face-uri[@loext:font-weight='bold' " + "and @loext:font-style='normal']/office:binary-data"); +#endif +} + CPPUNIT_TEST_FIXTURE(SdExportTest, testEmbeddedText) { createSdDrawDoc("objectwithtext.fodg");
