summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/qa/cppunit/pdfexport/data/tdf155161.odtbin0 -> 123319 bytes
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx40
2 files changed, 40 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf155161.odt b/vcl/qa/cppunit/pdfexport/data/tdf155161.odt
new file mode 100644
index 000000000000..1d22bb7c4d01
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/tdf155161.odt
Binary files differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 0739cd25cd8a..e19f989ce9b9 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -4779,6 +4779,46 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf152246)
}
}
+CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf155161)
+{
+// TODO: We seem to get a fallback font on Windows
+#ifndef _WIN32
+ vcl::filter::PDFDocument aDocument;
+ load(u"tdf155161.odt", aDocument);
+
+ // Check that all fonts in the document are Type 3 fonts
+ int nFonts = 0;
+ for (const auto& aElement : aDocument.GetElements())
+ {
+ auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get());
+ if (!pObject)
+ continue;
+ auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"));
+ if (pType && pType->GetValue() == "Font")
+ {
+ auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Subtype"));
+ CPPUNIT_ASSERT(pSubtype);
+ CPPUNIT_ASSERT_EQUAL(OString("Type3"), pSubtype->GetValue());
+
+ auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Name"));
+ CPPUNIT_ASSERT(pName);
+ CPPUNIT_ASSERT_EQUAL(OString("Cantarell-Regular"), pName->GetValue());
+
+ nFonts++;
+ }
+ }
+
+#ifdef MACOSX
+ // There must be two fonts
+ CPPUNIT_ASSERT_EQUAL(2, nFonts);
+#else
+ // But it seems that embedded variable fonts don’t register all supported
+ // styles on Linux, so the bold and regular text use the same regular font.
+ CPPUNIT_ASSERT(nFonts);
+#endif
+#endif
+}
+
} // end anonymous namespace
CPPUNIT_PLUGIN_IMPLEMENT();