sw/qa/extras/embedded_fonts/data/font_used_in_header_only.fodt |    6 
 sw/qa/extras/embedded_fonts/embedded_fonts.cxx                 |  297 
+++++++++-
 sw/qa/extras/odfexport/data/font_used_in_header_only.fodt      |   45 -
 sw/qa/extras/odfexport/odfexport2.cxx                          |   79 --
 sw/qa/extras/uiwriter/uiwriter6.cxx                            |  189 ------
 5 files changed, 292 insertions(+), 324 deletions(-)

New commits:
commit adb58391197cc8114d7aa33e7393d8778a15b57a
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Aug 13 10:15:04 2025 +0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Aug 18 09:13:21 2025 +0200

    Move some more tests to sw_embedded_fonts
    
    This move ended up nontrivial. It had unexpectedly broken already
    existing testFontEmbeddingDOCX on Linux, as in
    
     xmltesttools.cxx:215:Assertion
     Test name: (anonymous namespace)::testFontEmbeddingDOCX::TestBody
     equality assertion failed
     - Expected: 1
     - Actual  : 0
     - In <>, XPath '/w:fonts/w:font[@w:name='DejaVu Sans']/w:embedItalic' 
number of nodes is incorrect
    
    It turned out related to the oddities that I noted previously, both
    in testFontEmbeddingDOCX, and in tdf166627 (see the comments about
    different number of embeddings on Linux). It seems that there is a
    bug specifically in DejaVu Sans font (or in the Linux font manager?),
    that makes the font to have a wrong family type. It doesn't happen
    with DejaVu Serif, so I changed the tests to use it, which allowed
    to drop some #ifdef's.
    
    Change-Id: Ie5a80d2cb8ee7d3b3eaf0ec5adb9a8fcd119e28f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189468
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 8d9b573c0a3d6c78f4d30423b27d85b6b53009cb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189521
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/qa/extras/odfexport/data/embedded-font-props.odt 
b/sw/qa/extras/embedded_fonts/data/embedded-font-props.odt
similarity index 100%
rename from sw/qa/extras/odfexport/data/embedded-font-props.odt
rename to sw/qa/extras/embedded_fonts/data/embedded-font-props.odt
diff --git a/sw/qa/extras/embedded_fonts/data/font_used_in_header_only.fodt 
b/sw/qa/extras/embedded_fonts/data/font_used_in_header_only.fodt
index 3ef2c2791cfe..f59c428620cc 100644
--- a/sw/qa/extras/embedded_fonts/data/font_used_in_header_only.fodt
+++ b/sw/qa/extras/embedded_fonts/data/font_used_in_header_only.fodt
@@ -11,7 +11,7 @@
   </config:config-item-set>
  </office:settings>
  <office:font-face-decls>
-  <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu 
Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
+  <style:font-face style:name="DejaVu Serif" svg:font-family="&apos;DejaVu 
Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
   <style:font-face style:name="Liberation Serif" 
svg:font-family="&apos;Liberation Serif&apos;" 
style:font-family-generic="roman" style:font-pitch="variable"/>
  </office:font-face-decls>
  <office:styles>
@@ -22,7 +22,7 @@
  </office:styles>
  <office:automatic-styles>
   <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
-   <style:text-properties style:font-name="DejaVu Sans"/>
+   <style:text-properties style:font-name="DejaVu Serif"/>
   </style:style>
   <style:page-layout style:name="pm1">
    <style:header-style>
@@ -33,7 +33,7 @@
  <office:master-styles>
   <style:master-page style:name="Standard" style:page-layout-name="pm1">
    <style:header>
-    <text:p text:style-name="P1">Header: DejaVu Sans</text:p>
+    <text:p text:style-name="P1">Header: DejaVu Serif</text:p>
    </style:header>
   </style:master-page>
  </office:master-styles>
diff --git a/sw/qa/extras/uiwriter/data/testFontEmbedding.odt 
b/sw/qa/extras/embedded_fonts/data/testFontEmbedding.odt
similarity index 100%
rename from sw/qa/extras/uiwriter/data/testFontEmbedding.odt
rename to sw/qa/extras/embedded_fonts/data/testFontEmbedding.odt
diff --git a/sw/qa/extras/embedded_fonts/embedded_fonts.cxx 
b/sw/qa/extras/embedded_fonts/embedded_fonts.cxx
index c111b11a66fe..1a25f9c64301 100644
--- a/sw/qa/extras/embedded_fonts/embedded_fonts.cxx
+++ b/sw/qa/extras/embedded_fonts/embedded_fonts.cxx
@@ -10,6 +10,7 @@
 #include <sal/config.h>
 
 #include <config_features.h>
+#include <config_fonts.h>
 
 #include <swmodeltestbase.hxx>
 
@@ -377,6 +378,289 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf167849)
 }
 #endif
 
+CPPUNIT_TEST_FIXTURE(Test, tdf166627)
+{
+    createSwDoc("font_used_in_header_only.fodt");
+    saveAndReload(u"writer8"_ustr);
+    // DejaVu Serif wasn't embedded before fix, because it was only seen used 
in header
+
+    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
+
+    // There should be four files embedded for the font
+    assertXPath(pXmlDoc,
+                "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri",
+                4);
+
+    auto xZipNames = packages::zip::ZipFileAccess::createWithURL(
+        comphelper::getProcessComponentContext(), maTempFile.GetURL());
+
+    OUString url = getXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[1]",
+        "href");
+    CPPUNIT_ASSERT(xZipNames->hasByName(url));
+    url = getXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[2]",
+        "href");
+    CPPUNIT_ASSERT(xZipNames->hasByName(url));
+    url = getXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[3]",
+        "href");
+    CPPUNIT_ASSERT(xZipNames->hasByName(url));
+    url = getXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[4]",
+        "href");
+    CPPUNIT_ASSERT(xZipNames->hasByName(url));
+
+    // also test that common fonts don't get embedded
+
+    assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']");
+    assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation 
Serif']/svg:font-face-src", 0);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testFontEmbedding)
+{
+#if HAVE_MORE_FONTS && !defined(MACOSX)
+    createSwDoc("testFontEmbedding.odt");
+
+    OString 
aContentBaseXpath("/office:document-content/office:font-face-decls"_ostr);
+    OString 
aStylesBaseXpath("/office:document-styles/office:font-face-decls"_ostr);
+    OString aSettingsBaseXpath(
+        
"/office:document-settings/office:settings/config:config-item-set"_ostr);
+
+    xmlDocUniquePtr pXmlDoc;
+
+    // Get document settings
+    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xProps(
+        xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
+
+    // Check font embedding state
+    CPPUNIT_ASSERT_EQUAL(false, 
xProps->getPropertyValue(u"EmbedFonts"_ustr).get<bool>());
+    CPPUNIT_ASSERT_EQUAL(false, 
xProps->getPropertyValue(u"EmbedOnlyUsedFonts"_ustr).get<bool>());
+    // Font scripts should be enabled by default, however this has no effect 
unless "EmbedOnlyUsedFonts" is enabled
+    CPPUNIT_ASSERT_EQUAL(true, 
xProps->getPropertyValue(u"EmbedLatinScriptFonts"_ustr).get<bool>());
+    CPPUNIT_ASSERT_EQUAL(true, 
xProps->getPropertyValue(u"EmbedAsianScriptFonts"_ustr).get<bool>());
+    CPPUNIT_ASSERT_EQUAL(true,
+                         
xProps->getPropertyValue(u"EmbedComplexScriptFonts"_ustr).get<bool>());
+
+    // CASE 1 - no font embedding enabled
+
+    // Save the document
+    save(u"writer8"_ustr);
+    CPPUNIT_ASSERT(maTempFile.IsValid());
+
+    // Check setting - No font embedding should be enabled
+    pXmlDoc = parseExport(u"settings.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", u"false");
+
+    // Check styles - No font-face-src nodes should be present
+    pXmlDoc = parseExport(u"styles.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, aStylesBaseXpath + "/style:font-face['CASE 1']", 5);
+    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
+                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
+    {
+        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 1']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 1']", 0);
+    }
+
+    // Check content - No font-face-src nodes should be present
+    pXmlDoc = parseExport(u"content.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face['CASE 1']", 5);
+    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
+                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
+    {
+        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 1']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 1']", 0);
+    }
+
+    // CASE 2 - font embedding enabled, but embed used fonts disabled
+
+    // Enable font embedding, disable embedding used font only
+    xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(true));
+    xProps->setPropertyValue(u"EmbedOnlyUsedFonts"_ustr, uno::Any(false));
+
+    // Save the document again
+    save(u"writer8"_ustr);
+    CPPUNIT_ASSERT(maTempFile.IsValid());
+
+    // Check setting - font embedding should be enabled
+    pXmlDoc = parseExport(u"settings.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedOnlyUsedFonts']",
+        u"false");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedLatinScriptFonts']",
+        u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedAsianScriptFonts']",
+        u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedComplexScriptFonts']",
+        u"true");
+
+    // Check styles - font-face-src should be present for all fonts
+    pXmlDoc = parseExport(u"styles.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, aStylesBaseXpath + "/style:font-face['CASE 2']", 5);
+    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
+                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
+    {
+        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 2']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 2']", 1);
+    }
+
+    // Check content - font-face-src should be present for all fonts
+    pXmlDoc = parseExport(u"content.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face['CASE 2']", 5);
+    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
+                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
+    {
+        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 2']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 2']", 1);
+    }
+
+    // CASE 3 - font embedding enabled, embed only used fonts enabled
+
+    // Enable font embedding and setting to embed used fonts only
+    xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(true));
+    xProps->setPropertyValue(u"EmbedOnlyUsedFonts"_ustr, uno::Any(true));
+    xProps->setPropertyValue(u"EmbedLatinScriptFonts"_ustr, uno::Any(true));
+    xProps->setPropertyValue(u"EmbedAsianScriptFonts"_ustr, uno::Any(true));
+    xProps->setPropertyValue(u"EmbedComplexScriptFonts"_ustr, uno::Any(true));
+
+    // Save the document again
+    save(u"writer8"_ustr);
+    CPPUNIT_ASSERT(maTempFile.IsValid());
+
+    // Check setting - font embedding should be enabled + embed only used 
fonts and scripts
+    pXmlDoc = parseExport(u"settings.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedOnlyUsedFonts']",
+        u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedLatinScriptFonts']",
+        u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedAsianScriptFonts']",
+        u"true");
+    assertXPathContent(
+        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedComplexScriptFonts']",
+        u"true");
+
+    // Check styles - font-face-src should be present only for "DejaVu Serif"
+    pXmlDoc = parseExport(u"styles.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, aStylesBaseXpath + "/style:font-face['CASE 3']", 5);
+    for (auto fontName :
+         { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif Condensed", 
"DejaVu Serif Condensed1" })
+    {
+        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 3']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 0);
+    }
+    for (auto fontName : { "DejaVu Serif" })
+    {
+        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 3']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 1);
+    }
+
+    // Check content - font-face-src should be present only for DejaVu Sans 
Mono and DejaVu Serif
+    // Note that the used sets of fonts are different for styles.xml and 
content.xml
+    pXmlDoc = parseExport(u"content.xml"_ustr);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face['CASE 3']", 5);
+    for (auto fontName : { "DejaVu Sans", "DejaVu Serif Condensed", "DejaVu 
Serif Condensed1" })
+    {
+        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 3']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 0);
+    }
+    for (auto fontName : { "DejaVu Sans Mono", "DejaVu Serif" })
+    {
+        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
+        assertXPath(pXmlDoc, prefix + "['CASE 3']");
+        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 1);
+    }
+#endif
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testEmbeddedFontProps)
+{
+    createSwDoc("embedded-font-props.odt");
+    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xProps(
+        xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
+    xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(true));
+
+    saveAndReload(u"writer8"_ustr);
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+#if !defined(MACOSX)
+    // Test that font style/weight of embedded fonts is exposed.
+    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
+    // These failed, the attributes were missing.
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[1]",
+        "font-style", u"normal");
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[1]",
+        "font-weight", u"normal");
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[2]",
+        "font-style", u"normal");
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[2]",
+        "font-weight", u"bold");
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[3]",
+        "font-style", u"italic");
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[3]",
+        "font-weight", u"normal");
+#if defined _WIN32
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[4]",
+        "font-style", u"italic");
+    assertXPath(
+        pXmlDoc,
+        "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[4]",
+        "font-weight", u"bold");
+#endif
+#endif
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFontEmbeddingDOCX)
 {
     createSwDoc("font_used_in_header_only.fodt");
@@ -389,14 +673,11 @@ CPPUNIT_TEST_FIXTURE(Test, testFontEmbeddingDOCX)
 
     xmlDocUniquePtr pXml = parseExport(u"word/fontTable.xml"_ustr);
 
-    // Test that DejaVu Sans is embedded
-    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu Sans']/w:embedRegular");
-    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu Sans']/w:embedBold");
-    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu Sans']/w:embedItalic");
-// It is strange that DejaVu is different on Linux: see e.g. tdf166627 in 
odfexport2.cxx
-#if defined(_WIN32) || defined(MACOSX)
-    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu 
Sans']/w:embedBoldItalic");
-#endif
+    // Test that DejaVu Serif is embedded
+    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu 
Serif']/w:embedRegular");
+    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu Serif']/w:embedBold");
+    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu Serif']/w:embedItalic");
+    assertXPath(pXml, "/w:fonts/w:font[@w:name='DejaVu 
Serif']/w:embedBoldItalic");
 
     // Test that common fonts (here: Liberation Serif, Liberation Sans) are 
not embedded
     assertXPath(pXml, "/w:fonts/w:font[@w:name='Liberation Serif']");
diff --git a/sw/qa/extras/odfexport/data/font_used_in_header_only.fodt 
b/sw/qa/extras/odfexport/data/font_used_in_header_only.fodt
deleted file mode 100644
index 3ef2c2791cfe..000000000000
--- a/sw/qa/extras/odfexport/data/font_used_in_header_only.fodt
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
- <office:settings>
-  <config:config-item-set config:name="ooo:configuration-settings">
-   <config:config-item config:name="EmbedFonts" 
config:type="boolean">true</config:config-item>
-   <config:config-item config:name="EmbedOnlyUsedFonts" 
config:type="boolean">true</config:config-item>
-   <config:config-item config:name="EmbedLatinScriptFonts" 
config:type="boolean">true</config:config-item>
-   <config:config-item config:name="EmbedAsianScriptFonts" 
config:type="boolean">false</config:config-item>
-   <config:config-item config:name="EmbedComplexScriptFonts" 
config:type="boolean">false</config:config-item>
-  </config:config-item-set>
- </office:settings>
- <office:font-face-decls>
-  <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu 
Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
-  <style:font-face style:name="Liberation Serif" 
svg:font-family="&apos;Liberation Serif&apos;" 
style:font-family-generic="roman" style:font-pitch="variable"/>
- </office:font-face-decls>
- <office:styles>
-  <style:default-style style:family="paragraph">
-   <style:text-properties style:font-name="Liberation Serif" 
fo:font-size="12pt" fo:language="en" fo:country="US"/>
-  </style:default-style>
-  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
- </office:styles>
- <office:automatic-styles>
-  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
-   <style:text-properties style:font-name="DejaVu Sans"/>
-  </style:style>
-  <style:page-layout style:name="pm1">
-   <style:header-style>
-    <style:header-footer-properties fo:min-height="0" fo:margin-left="0" 
fo:margin-right="0" fo:margin-bottom="5mm"/>
-   </style:header-style>
-  </style:page-layout>
- </office:automatic-styles>
- <office:master-styles>
-  <style:master-page style:name="Standard" style:page-layout-name="pm1">
-   <style:header>
-    <text:p text:style-name="P1">Header: DejaVu Sans</text:p>
-   </style:header>
-  </style:master-page>
- </office:master-styles>
- <office:body>
-  <office:text>
-   <text:p>Body: Liberation Serif</text:p>
-  </office:text>
- </office:body>
-</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index d9250853cac6..d5f698bcd3c2 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -55,85 +55,6 @@ public:
     Test() : SwModelTestBase(u"/sw/qa/extras/odfexport/data/"_ustr, 
u"writer8"_ustr) {}
 };
 
-CPPUNIT_TEST_FIXTURE(Test, testEmbeddedFontProps)
-{
-    createSwDoc("embedded-font-props.odt");
-    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
-    uno::Reference<beans::XPropertySet> xProps(
-        xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
-    xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(true));
-
-    saveAndReload(mpFilter);
-    CPPUNIT_ASSERT_EQUAL(1, getPages());
-#if !defined(MACOSX)
-    // Test that font style/weight of embedded fonts is exposed.
-    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
-    // These failed, the attributes were missing.
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-style", u"normal");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-weight", u"normal");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-style", u"normal");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[2]", "font-weight", u"bold");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-style", u"italic");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[3]", "font-weight", u"normal");
-#if defined _WIN32
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-style", u"italic");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='DejaVu 
Serif']/svg:font-face-src/svg:font-face-uri[4]", "font-weight", u"bold");
-#endif
-#endif
-}
-
-CPPUNIT_TEST_FIXTURE(Test, tdf166627)
-{
-    loadAndReload("font_used_in_header_only.fodt");
-    // DejaVu Sans wasn't embedded before fix, because it was only seen used 
in header
-
-    xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr);
-
-    // There should be four (three on Linux? Why DejaVu differs there?) files 
embedded for the font
-#if defined(_WIN32) || defined(MACOSX)
-    assertXPath(
-        pXmlDoc,
-        "//style:font-face[@style:name='DejaVu 
Sans']/svg:font-face-src/svg:font-face-uri", 4);
-#else
-    assertXPath(
-        pXmlDoc,
-        "//style:font-face[@style:name='DejaVu 
Sans']/svg:font-face-src/svg:font-face-uri", 3);
-#endif
-
-    uno::Reference<container::XNameAccess> xZipNames(
-        
packages::zip::ZipFileAccess::createWithURL(comphelper::getProcessComponentContext(),
-                                                    maTempFile.GetURL()),
-        uno::UNO_SET_THROW);
-
-    OUString url = getXPath(
-        pXmlDoc,
-        "//style:font-face[@style:name='DejaVu 
Sans']/svg:font-face-src/svg:font-face-uri[1]",
-        "href");
-    CPPUNIT_ASSERT(xZipNames->hasByName(url));
-    url = getXPath(
-        pXmlDoc,
-        "//style:font-face[@style:name='DejaVu 
Sans']/svg:font-face-src/svg:font-face-uri[2]",
-        "href");
-    CPPUNIT_ASSERT(xZipNames->hasByName(url));
-    url = getXPath(
-        pXmlDoc,
-        "//style:font-face[@style:name='DejaVu 
Sans']/svg:font-face-src/svg:font-face-uri[3]",
-        "href");
-    CPPUNIT_ASSERT(xZipNames->hasByName(url));
-#if defined(_WIN32) || defined(MACOSX)
-    url = getXPath(
-        pXmlDoc,
-        "//style:font-face[@style:name='DejaVu 
Sans']/svg:font-face-src/svg:font-face-uri[4]",
-        "href");
-    CPPUNIT_ASSERT(xZipNames->hasByName(url));
-#endif
-
-    // also test that common fonts don't get embedded
-
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']");
-    assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation 
Serif']/svg:font-face-src", 0);
-}
-
 DECLARE_ODFEXPORT_TEST(testTdf100492, "tdf100492.odt")
 {
     CPPUNIT_ASSERT_EQUAL(2, getShapes());
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index d0c79d372345..8d1a5d187c46 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -2224,195 +2224,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf51223)
     CPPUNIT_ASSERT_EQUAL(u"i"_ustr, 
static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
-{
-#if HAVE_MORE_FONTS && !defined(MACOSX)
-    createSwDoc("testFontEmbedding.odt");
-
-    OString 
aContentBaseXpath("/office:document-content/office:font-face-decls"_ostr);
-    OString 
aStylesBaseXpath("/office:document-styles/office:font-face-decls"_ostr);
-    OString aSettingsBaseXpath(
-        
"/office:document-settings/office:settings/config:config-item-set"_ostr);
-
-    xmlDocUniquePtr pXmlDoc;
-
-    // Get document settings
-    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
-    uno::Reference<beans::XPropertySet> xProps(
-        xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), 
uno::UNO_QUERY_THROW);
-
-    // Check font embedding state
-    CPPUNIT_ASSERT_EQUAL(false, 
xProps->getPropertyValue(u"EmbedFonts"_ustr).get<bool>());
-    CPPUNIT_ASSERT_EQUAL(false, 
xProps->getPropertyValue(u"EmbedOnlyUsedFonts"_ustr).get<bool>());
-    // Font scripts should be enabled by default, however this has no effect 
unless "EmbedOnlyUsedFonts" is enabled
-    CPPUNIT_ASSERT_EQUAL(true, 
xProps->getPropertyValue(u"EmbedLatinScriptFonts"_ustr).get<bool>());
-    CPPUNIT_ASSERT_EQUAL(true, 
xProps->getPropertyValue(u"EmbedAsianScriptFonts"_ustr).get<bool>());
-    CPPUNIT_ASSERT_EQUAL(true,
-                         
xProps->getPropertyValue(u"EmbedComplexScriptFonts"_ustr).get<bool>());
-
-    // CASE 1 - no font embedding enabled
-
-    // Save the document
-    save(u"writer8"_ustr);
-    CPPUNIT_ASSERT(maTempFile.IsValid());
-
-    // Check setting - No font embedding should be enabled
-    pXmlDoc = parseExport(u"settings.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", u"false");
-
-    // Check styles - No font-face-src nodes should be present
-    pXmlDoc = parseExport(u"styles.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-
-    assertXPath(pXmlDoc, aStylesBaseXpath + "/style:font-face['CASE 1']", 5);
-    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
-                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
-    {
-        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 1']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 1']", 0);
-    }
-
-    // Check content - No font-face-src nodes should be present
-    pXmlDoc = parseExport(u"content.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-
-    assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face['CASE 1']", 5);
-    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
-                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
-    {
-        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 1']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 1']", 0);
-    }
-
-    // CASE 2 - font embedding enabled, but embed used fonts disabled
-
-    // Enable font embedding, disable embedding used font only
-    xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(true));
-    xProps->setPropertyValue(u"EmbedOnlyUsedFonts"_ustr, uno::Any(false));
-
-    // Save the document again
-    save(u"writer8"_ustr);
-    CPPUNIT_ASSERT(maTempFile.IsValid());
-
-    // Check setting - font embedding should be enabled
-    pXmlDoc = parseExport(u"settings.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedOnlyUsedFonts']",
-        u"false");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedLatinScriptFonts']",
-        u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedAsianScriptFonts']",
-        u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedComplexScriptFonts']",
-        u"true");
-
-    // Check styles - font-face-src should be present for all fonts
-    pXmlDoc = parseExport(u"styles.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-
-    assertXPath(pXmlDoc, aStylesBaseXpath + "/style:font-face['CASE 2']", 5);
-    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
-                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
-    {
-        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 2']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 2']", 1);
-    }
-
-    // Check content - font-face-src should be present for all fonts
-    pXmlDoc = parseExport(u"content.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-
-    assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face['CASE 2']", 5);
-    for (auto fontName : { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif",
-                           "DejaVu Serif Condensed", "DejaVu Serif Condensed1" 
})
-    {
-        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 2']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 2']", 1);
-    }
-
-    // CASE 3 - font embedding enabled, embed only used fonts enabled
-
-    // Enable font embedding and setting to embed used fonts only
-    xProps->setPropertyValue(u"EmbedFonts"_ustr, uno::Any(true));
-    xProps->setPropertyValue(u"EmbedOnlyUsedFonts"_ustr, uno::Any(true));
-    xProps->setPropertyValue(u"EmbedLatinScriptFonts"_ustr, uno::Any(true));
-    xProps->setPropertyValue(u"EmbedAsianScriptFonts"_ustr, uno::Any(true));
-    xProps->setPropertyValue(u"EmbedComplexScriptFonts"_ustr, uno::Any(true));
-
-    // Save the document again
-    save(u"writer8"_ustr);
-    CPPUNIT_ASSERT(maTempFile.IsValid());
-
-    // Check setting - font embedding should be enabled + embed only used 
fonts and scripts
-    pXmlDoc = parseExport(u"settings.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedOnlyUsedFonts']",
-        u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedLatinScriptFonts']",
-        u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedAsianScriptFonts']",
-        u"true");
-    assertXPathContent(
-        pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedComplexScriptFonts']",
-        u"true");
-
-    // Check styles - font-face-src should be present only for "DejaVu Serif"
-    pXmlDoc = parseExport(u"styles.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-
-    assertXPath(pXmlDoc, aStylesBaseXpath + "/style:font-face['CASE 3']", 5);
-    for (auto fontName :
-         { "DejaVu Sans", "DejaVu Sans Mono", "DejaVu Serif Condensed", 
"DejaVu Serif Condensed1" })
-    {
-        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 3']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 0);
-    }
-    for (auto fontName : { "DejaVu Serif" })
-    {
-        OString prefix = aStylesBaseXpath + "/style:font-face[@style:name='" + 
fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 3']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 1);
-    }
-
-    // Check content - font-face-src should be present only for DejaVu Sans 
Mono and DejaVu Serif
-    // Note that the used sets of fonts are different for styles.xml and 
content.xml
-    pXmlDoc = parseExport(u"content.xml"_ustr);
-    CPPUNIT_ASSERT(pXmlDoc);
-
-    assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face['CASE 3']", 5);
-    for (auto fontName : { "DejaVu Sans", "DejaVu Serif Condensed", "DejaVu 
Serif Condensed1" })
-    {
-        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 3']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 0);
-    }
-    for (auto fontName : { "DejaVu Sans Mono", "DejaVu Serif" })
-    {
-        OString prefix = aContentBaseXpath + "/style:font-face[@style:name='" 
+ fontName + "']";
-        assertXPath(pXmlDoc, prefix + "['CASE 3']");
-        assertXPath(pXmlDoc, prefix + "/svg:font-face-src['CASE 3']", 1);
-    }
-#endif
-}
-
 // Unit test for fix inconsistent bookmark behavior around at-char/as-char 
anchored frames
 //
 // We have a placeholder character in the sw doc model for as-char anchored 
frames,

Reply via email to