[Libreoffice-commits] core.git: editeng/source svx/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 11 19:28:48 UTC 2020
editeng/source/editeng/impedit3.cxx | 7 +++++++
svx/source/svdraw/svdotextdecomposition.cxx | 8 ++++----
2 files changed, 11 insertions(+), 4 deletions(-)
New commits:
commit ba09d436dfd1f0b07b95aad3d375e7cd7318440b
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Fri Feb 21 14:21:08 2020 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Wed Mar 11 20:28:09 2020 +0100
tdf#89849 editeng: adjust escapement before resetting Propr
THIS IS A LAYOUT REGRESSION FIX FOR SUBSCRIPTS/SUPERSCRIPTS.
The position of subscripts and superscripts is a percentage
based on the 100% fontsize. When LO 4.1 tricked the font
into thinking it was 100%, it failed to adjust the escapement
to be relative to the new fake size. In the default case,
this meant that the superscript was only raised about half
as much as it should have.
THIS CHANGE WILL AFFECT EXISTING DOCUMENTS WHERE THE
TEXTBOX IS SET TO "AUTOFIT THE TEXT". This will primarily
be Impress documents, since many of the templates enable
autofit text.
As a result of this bug, users creating new documents since
4.1 using autofit-text will have specified highly exaggerated
subscript/superscript positioning in order to look nice.
This fix will expose the exaggerated percentages and make the
document look poor. I don't know how that can be avoided.
Nor do I know how to create a unit test for a layout bug.
I guess QA's PDF compare tests will suffice for this. A
clearly exaggerated unit test is attached to the bug report.
The new ability to have a larger-than-100% escapement in
LO 6.3 comes in handy here, so that small superscripts can
gain a fake escapment big enough to put them in the proper
position.
Change-Id: I0f8dcff8741eb05d8657235930a4eb684629b9d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89214
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 9e82076b1c99..6ec2a6152ee6 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -30,6 +30,7 @@
#include "impedit.hxx"
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
+#include <editeng/escapementitem.hxx>
#include <editeng/txtrange.hxx>
#include <editeng/colritem.hxx>
#include <editeng/udlnitem.hxx>
@@ -2757,6 +2758,12 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
rFont.SetPhysFont( pDev );
FontMetric aMetric( pDev->GetFontMetric() );
+ // before forcing nPropr to 100%, calculate a new escapement relative to this fake size.
+ sal_uInt8 nPropr = rFont.GetPropr();
+ sal_Int16 nEsc = rFont.GetEscapement();
+ if ( nPropr && nEsc && nPropr != 100 && abs(nEsc) != DFLT_ESC_AUTO_SUPER )
+ rFont.SetEscapement( 100.0/nPropr * nEsc );
+
// Set the font as we want it to look like & reset the Propr attribute
// so that it is not counted twice.
Size aRealSz( aMetric.GetFontSize() );
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 9f56c2730eb3..36734264f185 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -197,13 +197,13 @@ namespace
nEsc = -20;
}
- if(nEsc > 100)
+ if(nEsc > MAX_ESC_POS)
{
- nEsc = 100;
+ nEsc = MAX_ESC_POS;
}
- else if(nEsc < -100)
+ else if(nEsc < -MAX_ESC_POS)
{
- nEsc = -100;
+ nEsc = -MAX_ESC_POS;
}
const double fEscapement(nEsc / -100.0);
More information about the Libreoffice-commits
mailing list