[Libreoffice-commits] core.git: Branch 'libreoffice-4-1-1' - xmloff/source

Caolán McNamara caolanm at redhat.com
Tue Aug 20 09:13:35 PDT 2013


 xmloff/source/text/txtexppr.cxx |   59 +++++++++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 18 deletions(-)

New commits:
commit ea3863d2597d70719b2e590260c05fd8aecc7836
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 20 11:37:04 2013 +0100

    Resolves: fdo#67665 font names filtered out on odp/odg export
    
    Change-Id: Ia529992d15152db981379a1e0a4dec63b2dad40c
    (cherry picked from commit 26dc5f2ee67342bd474640e1cc39b96d3220721b)
    Reviewed-on: https://gerrit.libreoffice.org/5540
    Reviewed-by: Thorsten Behrens <tbehrens at suse.com>
    Tested-by: Thorsten Behrens <tbehrens at suse.com>
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index eb89488..a13c587 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -217,25 +217,48 @@ void XMLTextExportPropertySetMapper::ContextFontFilter(
     if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
         eEnc = (rtl_TextEncoding)nTmp;
 
-    OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
-                        sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
-    if( !sName.isEmpty() )
+    //Resolves: fdo#67665 The purpose here appears to be to replace
+    //FontFamilyName and FontStyleName etc with a single FontName property. The
+    //problem is that repeated calls to here will first set
+    //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
+    //next time pFontFamilyNameState is not passed here at all, which gives an
+    //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
+    //That doesn't seem right to me.
+    //
+    //So assuming that the main purpose is just to convert the properties in
+    //the main when we can, and to leave them alone when we can't. And with a
+    //secondary purpose to filter out empty font properties, then is would
+    //appear to make sense to base attempting the conversion if we have
+    //both of the major facts of the font description
+    //
+    //An alternative solution is to *not* fill the FontAutoStylePool with
+    //every font in the document, but to partition the fonts into the
+    //hard-attribute fonts which go into that pool and the style-attribute
+    //fonts which go into some additional pool which get merged just for
+    //the purposes of writing the embedded fonts but are not queried by
+    //"Find" which restores the original logic.
+    if (pFontFamilyNameState || pFontStyleNameState)
     {
-        pFontNameState->maValue <<= sName;
-        if( pFontFamilyNameState )
-            pFontFamilyNameState->mnIndex = -1;
-        if( pFontStyleNameState )
-            pFontStyleNameState->mnIndex = -1;
-        if( pFontFamilyState )
-            pFontFamilyState->mnIndex = -1;
-        if( pFontPitchState )
-            pFontPitchState->mnIndex = -1;
-        if( pFontCharsetState )
-            pFontCharsetState->mnIndex = -1;
-    }
-    else
-    {
-        pFontNameState->mnIndex = -1;
+        OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
+                            sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
+        if( !sName.isEmpty() )
+        {
+            pFontNameState->maValue <<= sName;
+            if( pFontFamilyNameState )
+                pFontFamilyNameState->mnIndex = -1;
+            if( pFontStyleNameState )
+                pFontStyleNameState->mnIndex = -1;
+            if( pFontFamilyState )
+                pFontFamilyState->mnIndex = -1;
+            if( pFontPitchState )
+                pFontPitchState->mnIndex = -1;
+            if( pFontCharsetState )
+                pFontCharsetState->mnIndex = -1;
+        }
+        else
+        {
+            pFontNameState->mnIndex = -1;
+        }
     }
 
     if( pFontFamilyNameState && sFamilyName.isEmpty() )


More information about the Libreoffice-commits mailing list