summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-11-16 12:51:37 +0100
committerLászló Németh <nemeth@numbertext.org>2021-11-24 14:38:14 +0100
commit98fedbc8501b53a199afa4a879707bf89a7f84e5 (patch)
tree42b49fd2711e6ca594fbf6161fe9f761d1b3d1fe /oox
parentbf0e6dbaf3cb288f08bb2d0226d73a0c20f0e154 (diff)
tdf#124781 PPTX export: fix superscript and subscript positions
"Raise/lower by" character settings were saved incorrectly when the automatic checkbox is checked. Change-Id: Ia7260504cde85e14867936c83eaf8735142e2c53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125302 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx27
1 files changed, 22 insertions, 5 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3371c04eac8e..af96b14f1ac6 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -121,6 +121,7 @@
#include <editeng/unonames.hxx>
#include <editeng/unoprnms.hxx>
#include <editeng/flditem.hxx>
+#include <editeng/escapementitem.hxx>
#include <svx/svdoashp.hxx>
#include <svx/svdomedia.hxx>
#include <svx/unoapi.hxx>
@@ -1906,6 +1907,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
sal_Int32 nSize = 1800;
sal_Int32 nCharEscapement = 0;
sal_Int32 nCharKerning = 0;
+ sal_Int32 nCharEscapementHeight = 0;
if ( nElement == XML_endParaRPr && rbOverridingCharHeight )
{
@@ -2059,12 +2061,27 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
&& eState == beans::PropertyState_DIRECT_VALUE)
mAny >>= nCharEscapement;
- if (nCharEscapement
- && (GetPropertyAndState(rXPropSet, rXPropState, "CharEscapementHeight", eState)
- && eState == beans::PropertyState_DIRECT_VALUE))
- {
- sal_uInt32 nCharEscapementHeight = 0;
+ if (GetPropertyAndState(rXPropSet, rXPropState, "CharEscapementHeight", eState)
+ && eState == beans::PropertyState_DIRECT_VALUE)
mAny >>= nCharEscapementHeight;
+
+ if (DFLT_ESC_AUTO_SUPER == nCharEscapement)
+ {
+ // Raised by the differences between the ascenders (ascent = baseline to top of highest letter).
+ // The ascent is generally about 80% of the total font height.
+ // That is why DFLT_ESC_PROP (58) leads to 33% (DFLT_ESC_SUPER)
+ nCharEscapement = .8 * (100 - nCharEscapementHeight);
+ }
+ else if (DFLT_ESC_AUTO_SUB == nCharEscapement)
+ {
+ // Lowered by the differences between the descenders (descent = baseline to bottom of lowest letter).
+ // The descent is generally about 20% of the total font height.
+ // That is why DFLT_ESC_PROP (58) leads to 8% (DFLT_ESC_SUB)
+ nCharEscapement = .2 * -(100 - nCharEscapementHeight);
+ }
+
+ if (nCharEscapement && nCharEscapementHeight)
+ {
nSize = (nSize * nCharEscapementHeight) / 100;
// MSO uses default ~58% size
nSize = (nSize / 0.58);