summaryrefslogtreecommitdiff
path: root/editeng/source/editeng/impedit4.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2020-02-17 20:20:31 +0300
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-03-03 16:20:03 +0100
commit2940d1905b921d9909b08b1e32014d3c44474ef0 (patch)
tree370d048aa01a44c5a900e751b818eceb9acdc84b /editeng/source/editeng/impedit4.cxx
parentb9a124aae67cbd64917f07f2dca6603f149c018b (diff)
tdf#80194 editeng: fix auto subscript calculations
...and auto superscript too (although not as noticably). THIS WILL CHANGE THE POSITION OF EDITENG SUBSCRIPTS AND SUPERSCRIPTS IN EXISTING DOCUMENTS! That is because they were very poorly placed before - using a formula that is very different from how Writer does it. Everyone in the bug reports indicates that Writer does it good, but Impress does it really bad. (tdf#89849, tdf#63083) FOR EXAMPLE, when the char-size is reduced to the default OF 58%, it will now be raised by 33%, not 42%. Likewise, the subscript will now be lowered by 8%, not 42%. THIS AFFECTS/FIXES Writer textboxes, Calc, Draw/Impress. "Automatic" indicates that there is not a "correct" answer, but that the computer should make it "look good", so the user should be able to accept this change in positioning, as long as it looks good. The number of documents affected might be less than one would expect. By default .uno:SuperScript does NOT set auto mode (although Format-Character does). Since most people would use the toolbar instead of the format menu to create a superscript, auto will be rare. So there will be relatively few cases where subscripts are automatic in editeng, especially since it looks so poor that most people probably turned automatic off... This patch has no effect on non-automatic escapement. It uses the same fomula that calculated DFLT_ESC_SUB (since it isn't an arbitrarily chosen value). This is an approximation of the formula that Writer uses (since Writer does exact calculations based on each font's metrics). This Writer-inspired formula was introduced in LO 6.4 for more accurate exporting to MSO word processing formats (tdf#127316). Change-Id: I0267810efe31a2b3be41bf2d39e2278ce9bc99e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88911 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'editeng/source/editeng/impedit4.cxx')
-rw-r--r--editeng/source/editeng/impedit4.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 67e924653618..25d7ecc0aa8a 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -930,12 +930,12 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput,
short nEsc = static_cast<const SvxEscapementItem&>(rItem).GetEsc();
if ( nEsc == DFLT_ESC_AUTO_SUPER )
{
- nEsc = 100 - nProp;
+ nEsc = .8 * (100 - nProp);
nProp100++; // A 1 afterwards means 'automatic'.
}
else if ( nEsc == DFLT_ESC_AUTO_SUB )
{
- nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
+ nEsc = .2 * -(100 - nProp);
nProp100++;
}
// SWG: