[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Dec 6 10:21:13 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf99602_charStyleSubscript2.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 15 ++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 8 +++++
3 files changed, 23 insertions(+)
New commits:
commit 35efcf0a8e2d33dc3e9c24254ca7767ac921cea5
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Thu Nov 28 16:33:57 2019 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Dec 6 11:20:09 2019 +0100
tdf#99602 writerfilter: export only default subscript in styles
support for subscripts in character styles was added in LO 6.4.
On import, we just assume default values for superscript
and subscript _FOR STYLES_. So exporting should do the same
thing.
What was happening was that - for the non-default,
non-automatic subscript settings - the character style fontsize was
being reduced to the proportional size, but then on import
the reduced fontsize was loaded, as well as the default subscript
settings being applied again, reducing it by another 42%,
so effectively the subscripting was being applied twice.
Yes, defaults-only means that anyone tinkering around with
non-automatic subscripts won't get exact replication - but
trying to emulate LO's percentage based system and Word's
fontsize/distance system is way too complex when styles
are involved. Just note that subscripts/superscripts are used
and let the computer handle it - which generally looks best anyway.
Reviewed-on: https://gerrit.libreoffice.org/84008
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
(cherry picked from commit 8f7010eb47119a2428b77f5d79fc8577d9914958)
Change-Id: Idef6a084abff47dcdbe7a340cf74273a7482d430
Reviewed-on: https://gerrit.libreoffice.org/84395
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf99602_charStyleSubscript2.odt b/sw/qa/extras/ooxmlexport/data/tdf99602_charStyleSubscript2.odt
new file mode 100644
index 000000000000..a82c81564682
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf99602_charStyleSubscript2.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index f2cbdd1f545e..41923490b057 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -263,6 +263,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99602_charStyleSubscript, "tdf99602_charStyleSub
CPPUNIT_ASSERT_EQUAL( sal_Int16(DFLT_ESC_PROP), getProperty<sal_Int16>(getRun(xPara, 2), "CharEscapementHeight") );
}
+DECLARE_OOXMLEXPORT_TEST(testTdf99602_charStyleSubscript2, "tdf99602_charStyleSubscript2.odt")
+{
+ // *_In styles_*, don't let the proportionality/escapement affect the fontsize - otherwise it starts doubling up,
+ // so instead just throw away the values and use the default settings instead - meaning fontsize is unaffected.
+ // subscript custom: Proprtional size is 80%, lower by 25%.
+ uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName("subscript custom"), uno::UNO_QUERY);
+ float fCharHeight = getProperty<float>(xStyle, "CharHeight");
+ // a bug from LO 4.3 means that character styles round-trip with the wrong fontsize (10) instead of 12.
+ CPPUNIT_ASSERT_MESSAGE("CharStyle has 12pt font size", 12.f == fCharHeight || 10.f == fCharHeight );
+ // subscript larger font: Proportional size is 80%, lowered by DFLT_ESC_SUB_AUTO
+ xStyle.set(getStyles("CharacterStyles")->getByName("subscript larger font"), uno::UNO_QUERY);
+ fCharHeight = getProperty<float>(xStyle, "CharHeight");
+ CPPUNIT_ASSERT_MESSAGE("Auto CharStyle has 12pt font size", 12.f == fCharHeight || 10.f == fCharHeight );
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf124637_sectionMargin, "tdf124637_sectionMargin.docx")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 418477b6e16a..7a01c9ff1533 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6847,6 +6847,14 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
{
OString sIss;
short nEsc = rEscapement.GetEsc(), nProp = rEscapement.GetProportionalHeight();
+
+ // Simplify styles to avoid impossible complexity. Import and export as defaults only
+ if ( m_rExport.m_bStyDef && nEsc )
+ {
+ nProp = DFLT_ESC_PROP;
+ nEsc = (nEsc > 0) ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB;
+ }
+
if ( !nEsc )
{
sIss = OString( "baseline" );
More information about the Libreoffice-commits
mailing list