diff options
author | Justin Luth <justin_luth@sil.org> | 2020-02-19 16:13:05 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2020-02-19 20:58:43 +0100 |
commit | 94a3ac2b6f89aeac5b947034eb4d7e63838218e3 (patch) | |
tree | 1bb06271a4af1f5b302a3b51d958afa05af9299f /editeng | |
parent | e6fa52c2c371c7adc9c2c2cb18c3a8cf782cfa4b (diff) |
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@sil.org>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
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 )); |