diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-20 11:37:04 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-08-20 14:06:50 +0000 |
commit | ba85d483d392f2fa37a92e5fda56c0c121c6d8bc (patch) | |
tree | 89a0bba5bf7d10c27168f9de3319079b5b7e8192 | |
parent | e59c8de22549b623a06216f4f5e8568aa8fd3312 (diff) |
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/5533
Reviewed-by: Thorsten Behrens <tbehrens@suse.com>
Tested-by: Thorsten Behrens <tbehrens@suse.com>
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index eb89488e1054..a13c5875602b 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() ) |