[Libreoffice-commits] core.git: filter/source sw/qa

Svante Schubert (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 2 12:21:36 UTC 2021


 filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl |   14 +++++++---
 sw/qa/extras/htmlexport/xhtmlexport.cxx                                 |    2 -
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 63b4f0c693cf181e63772170c0c2c6179ec1b621
Author:     Svante Schubert <svante.schubert at gmail.com>
AuthorDate: Mon Aug 24 11:47:07 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Mar 2 13:20:44 2021 +0100

    HTML XSLT: Placing font-family names within 'double quotation marks' in case of spaces within the font name
    
    Change-Id: I780845df636c6a07bd621fa01cb60134d3ead592
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111610
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
index ec5b680df150..d4418725f2fc 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
@@ -79,13 +79,21 @@
     </xsl:template>
 
     <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
-    <xsl:template match="@fo:color |@svg:font-family |@fo:font-size |@fo:font-style |@fo:font-weight |@fo:text-indent |@fo:text-shadow |@text:display">
+    <xsl:template match="@fo:color |@fo:font-size |@fo:font-style |@fo:font-weight |@fo:text-indent |@fo:text-shadow |@text:display">
         <xsl:value-of select="substring-after(name(), ':')"/>
         <xsl:text>:</xsl:text>
         <xsl:value-of select="."/>
         <xsl:text>; </xsl:text>
     </xsl:template>
 
+    <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
+    <xsl:template match="@svg:font-family">
+        <xsl:value-of select="substring-after(name(), ':')"/>
+        <xsl:text>:"</xsl:text>
+        <xsl:value-of select="."/>
+        <xsl:text>"; </xsl:text>
+    </xsl:template>
+
     <!-- workaround AOOO#119401 suspicious property fo:margin="100%" in paragraph style -->
     <xsl:template match="@fo:margin[string(.) = '100%']"/>
 
@@ -206,12 +214,12 @@
     <xsl:template match="@style:font-name">
         <xsl:param name="globalData" />
 
-        <xsl:text>font-family:</xsl:text>
+        <xsl:text>font-family:"</xsl:text>
         <xsl:variable name="content" select="."/>
         <xsl:variable name="quote">'</xsl:variable>
         <xsl:variable name="fontName" select="$globalData/office:font-face-decls/style:font-face[@style:name=$content]/@svg:font-family" />
         <xsl:value-of select="translate($fontName, $quote, '')"/>
-        <xsl:text>; </xsl:text>
+        <xsl:text>"; </xsl:text>
     </xsl:template>
 
     <xsl:template match="@style:row-height">
diff --git a/sw/qa/extras/htmlexport/xhtmlexport.cxx b/sw/qa/extras/htmlexport/xhtmlexport.cxx
index 85adfa2b7b49..218bb4772eb4 100644
--- a/sw/qa/extras/htmlexport/xhtmlexport.cxx
+++ b/sw/qa/extras/htmlexport/xhtmlexport.cxx
@@ -49,7 +49,7 @@ DECLARE_HTMLEXPORT_TEST(testTdf131812, "tdf131812.odt")
     sal_uInt64 nLength = pStream->TellEnd();
     OString aStream(read_uInt8s_ToOString(*pStream, nLength));
     CPPUNIT_ASSERT(
-        aStream.indexOf(".P1 { font-size:12pt; font-family:Liberation Serif; "
+        aStream.indexOf(".P1 { font-size:12pt; font-family:\"Liberation Serif\"; "
                         "writing-mode:horizontal-tb; direction:rtl; text-align:right ! important;}")
         != -1);
 }


More information about the Libreoffice-commits mailing list