[Libreoffice-commits] core.git: editeng/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 19 19:59:23 UTC 2020
editeng/source/rtf/rtfitem.cxx | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
New commits:
commit 94a3ac2b6f89aeac5b947034eb4d7e63838218e3
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Feb 19 16:13:05 2020 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Wed Feb 19 20:58:43 2020 +0100
related tdf#80194 editeng RTF: set automatic subscript for \sub
The RTF specs say that \sub means "Subscripts text and shrinks
point size according to font information."
while \up is unambiguous with "Subscript position in half-points
(the default is 6)."
So, \sub leaves it up to the program to set the best values
for subscripting or superscripting. That would correspond
to the auto values.
Previously, this translated into a 26% superscript (close to
the default of 33%) and a 26% subscript (which is way too low).
For unit tests: although I managed to open an RTF file in draw,
it had no text in it, so I couldn't write a test. In the UI,
you use the Page menu to "Insert page from file".
Change-Id: I06003dbe2177fc87237624438b4daaaaf2482631
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89020
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index acfc59c9e6b3..45a579d6e301 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -540,13 +540,13 @@ SET_FONTALIGNMENT:
if( aPlainMap.nEscapement )
{
const sal_uInt16 nEsc = aPlainMap.nEscapement;
- if( -1 == nTokenValue || RTF_SUB == nToken )
- nTokenValue = 6;
+ if( -1 == nTokenValue )
+ nTokenValue = 6; //RTF default \dn value in half-points
if( IsCalcValue() )
CalcValue();
const SvxEscapementItem& rOld =
static_cast<const SvxEscapementItem&>(pSet->Get( nEsc,false));
- short nEs;
+ sal_Int16 nEs;
sal_uInt8 nProp;
if( DFLT_ESC_AUTO_SUPER == rOld.GetEsc() )
{
@@ -555,7 +555,7 @@ SET_FONTALIGNMENT:
}
else
{
- nEs = static_cast<short>(-nTokenValue);
+ nEs = (nToken == RTF_SUB) ? DFLT_ESC_AUTO_SUB : -nTokenValue;
nProp = (nToken == RTF_SUB) ? DFLT_ESC_PROP : 100;
}
pSet->Put( SvxEscapementItem( nEs, nProp, nEsc ));
@@ -900,13 +900,13 @@ ATTR_SETOVERLINE:
if( aPlainMap.nEscapement )
{
const sal_uInt16 nEsc = aPlainMap.nEscapement;
- if( -1 == nTokenValue || RTF_SUPER == nToken )
- nTokenValue = 6;
+ if( -1 == nTokenValue )
+ nTokenValue = 6; //RTF default \up value in half-points
if( IsCalcValue() )
CalcValue();
const SvxEscapementItem& rOld =
static_cast<const SvxEscapementItem&>(pSet->Get( nEsc,false));
- short nEs;
+ sal_Int16 nEs;
sal_uInt8 nProp;
if( DFLT_ESC_AUTO_SUB == rOld.GetEsc() )
{
@@ -915,7 +915,7 @@ ATTR_SETOVERLINE:
}
else
{
- nEs = static_cast<short>(nTokenValue);
+ nEs = (nToken == RTF_SUPER) ? DFLT_ESC_AUTO_SUPER : nTokenValue;
nProp = (nToken == RTF_SUPER) ? DFLT_ESC_PROP : 100;
}
pSet->Put( SvxEscapementItem( nEs, nProp, nEsc ));
More information about the Libreoffice-commits
mailing list