diff options
author | Justin Luth <justin_luth@sil.org> | 2020-02-21 14:21:08 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2020-03-11 20:28:09 +0100 |
commit | ba09d436dfd1f0b07b95aad3d375e7cd7318440b (patch) | |
tree | 43d117d01960230bac29c249b47d99b319a5e361 /editeng | |
parent | 97e9a83888a377035f99fc6dd0566482469a3dfa (diff) |
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@sil.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
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() ); |