editeng/source/items/svxfont.cxx | 8 ++++++++ svx/source/svdraw/svdotextdecomposition.cxx | 7 ++++++- sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-)
New commits: commit 888cff8bb0326153415b1d64d1ca6a45ac3ae84c Author: Justin Luth <justin_l...@sil.org> AuthorDate: Wed Feb 19 08:49:07 2020 +0300 Commit: Justin Luth <justin_l...@sil.org> CommitDate: Fri Mar 13 05:33:10 2020 +0100 tdf#80194 proof search: assert to find proof of code correctness. I'm sure that these functions need to change because they just seem very wrong. I think these are fall-back, safety sections because usually the nEsc is already converted away from _AUTO_ prior to reaching this point. But this is all just based on code-reading. It would be nice to have proof of this - especially since the values for subscript are unexpected. I would have expected it to use a value comparable to DFLT_ESC_SUB, and not some random/magical -20. (Note: the _AUTO_SUPER historically refered to an absolute 33 and not DFLT_ESC_SUPER until I recently changed that...) Change-Id: I3bef0841f9a20f09994b2372e9a7db5941b29c9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88997 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 891f3e2ab7c0..a8792df4c729 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -510,9 +510,17 @@ void SvxFont::DrawPrev( OutputDevice *pOut, Printer* pPrinter, { short nTmpEsc; if( DFLT_ESC_AUTO_SUPER == nEsc ) + { + nTmpEsc = .8 * (100 - nPropr); + assert (nTmpEsc == DFLT_ESC_SUPER && "I'm sure this formula needs to be changed, but how to confirm that???"); nTmpEsc = DFLT_ESC_SUPER; + } else if( DFLT_ESC_AUTO_SUB == nEsc ) + { + nTmpEsc = .2 * -(100 - nPropr); + assert (nTmpEsc == -20 && "I'm sure this formula needs to be changed, but how to confirm that???"); nTmpEsc = -20; + } else nTmpEsc = nEsc; Size aSize = GetFontSize(); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 36734264f185..8769b16b8ddc 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -171,7 +171,8 @@ namespace aNewTransform.scale(aFontScaling.getX(), aFontScaling.getY()); // look for proportional font scaling, if necessary, scale accordingly - if(100 != rInfo.mrFont.GetPropr()) + sal_Int8 nPropr(rInfo.mrFont.GetPropr()); + if(100 != nPropr) { const double fFactor(rInfo.mrFont.GetPropr() / 100.0); aNewTransform.scale(fFactor, fFactor); @@ -190,10 +191,14 @@ namespace if(DFLT_ESC_AUTO_SUPER == nEsc) { + nEsc = .8 * (100 - nPropr); + assert (nEsc == DFLT_ESC_SUPER && "I'm sure this formula needs to be changed, but how to confirm that???"); nEsc = DFLT_ESC_SUPER; } else if(DFLT_ESC_AUTO_SUB == nEsc) { + nEsc = .2 * -(100 - nPropr); + assert (nEsc == -20 && "I'm sure this formula needs to be changed, but how to confirm that???"); nEsc = -20; } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 67745700cc04..45d7c26addeb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -273,7 +273,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99602_charStyleSubscript2, "tdf99602_charStyleSu // subscript custom: Proportional 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 + // subscript larger font: Proportional size is 80%, lowered by DFLT_ESC_AUTO_SUB 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")); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits