summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-11-28 14:27:59 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-11-28 19:32:46 +0100
commit9914ca04ac6a63f14adcd0fe58b2be44b84ee15f (patch)
tree4693569a04d79cab122fef8f97f8742858196132 /sw
parentc8e37ef268cae23a92c298721f1493daeda323c2 (diff)
ODF export: expose font style and weight of embedded fonts
We don't need this info ourselves, but when converting the flat ODF output to other formats, this information is hard to find out, so state them explicitly. Names correspond to existing CSS ones, where it's necessary to state these explicitly. The EPUB export will make use of these attributes. (It is unclear why the test fails on the windows_msc_dbgutil_32 slave, it works for me locally.) Change-Id: I05030b6a14aca842e5a740786f3743e9ae838293 Reviewed-on: https://gerrit.libreoffice.org/45384 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_odfexport.mk5
-rw-r--r--sw/qa/extras/odfexport/data/embedded-font-props.odtbin0 -> 8097 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx20
3 files changed, 25 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_odfexport.mk b/sw/CppunitTest_sw_odfexport.mk
index e8c43ad931c9..da931c3f3006 100644
--- a/sw/CppunitTest_sw_odfexport.mk
+++ b/sw/CppunitTest_sw_odfexport.mk
@@ -54,4 +54,9 @@ $(eval $(call gb_CppunitTest_use_custom_headers,sw_odfexport,\
$(eval $(call gb_CppunitTest_use_configuration,sw_odfexport))
+ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),)
+$(call gb_CppunitTest_get_target,sw_odfexport): \
+ $(call gb_ExternalPackage_get_target,fonts_liberation)
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/sw/qa/extras/odfexport/data/embedded-font-props.odt b/sw/qa/extras/odfexport/data/embedded-font-props.odt
new file mode 100644
index 000000000000..6eb073e29fe0
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/embedded-font-props.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 60a1ceef489f..eea19faccea8 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1668,6 +1668,26 @@ DECLARE_ODFEXPORT_TEST(testImageMimetype, "image-mimetype.odt")
}
}
+DECLARE_ODFEXPORT_TEST(testEmbeddedFontProps, "embedded-font-props.odt")
+{
+#if !defined(WNT)
+ // Test that font style/weight of embedded fonts is exposed.
+ // Test file is a normal ODT, except EmbedFonts is set to true in settings.xml.
+ if (xmlDocPtr pXmlDoc = parseExport("content.xml"))
+ {
+ // These failed, the attributes were missing.
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-style", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-weight", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-style", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-weight", "bold");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-style", "italic");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-weight", "normal");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-style", "italic");
+ assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-weight", "bold");
+ }
+#endif
+}
+
DECLARE_ODFEXPORT_TEST(testTdf100492, "tdf100492.odt")
{
uno::Reference<drawing::XShape> xShape = getShape(1);