sw/qa/extras/ooxmlexport/data/tdf99602_charStyleSubscript2.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 12 ++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 8 ++++++ 3 files changed, 20 insertions(+)
New commits: commit 8f7010eb47119a2428b77f5d79fc8577d9914958 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Thu Nov 28 16:33:57 2019 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Dec 4 10:42:23 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. Change-Id: Idef6a084abff47dcdbe7a340cf74273a7482d430 Reviewed-on: https://gerrit.libreoffice.org/84008 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@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 0d6cdb8b37ae..6ce7780efe81 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -264,6 +264,18 @@ 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); + CPPUNIT_ASSERT_EQUAL_MESSAGE("CharStyle has 12pt font size", 12.f, getProperty<float>(xStyle, "CharHeight")); + // subscript larger font: Proportional size is 80%, lowered by DFLT_ESC_SUB_AUTO + xStyle.set(getStyles("CharacterStyles")->getByName("subscript larger font"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Auto CharStyle has 12pt font size", 12.f, getProperty<float>(xStyle, "CharHeight")); +} + 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 1a38df57c15f..70a540baf192 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6836,6 +6836,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" ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits