diff options
author | Justin Luth <justin_luth@sil.org> | 2017-05-15 09:28:59 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-05-16 14:52:51 +0200 |
commit | c7e31f492140a064d9c152583bda3d111c8bee83 (patch) | |
tree | 9650bdd393b76445c42c352bcc195a3a10aba769 /sw/source/filter/ww8/docxattributeoutput.cxx | |
parent | b53c84af0a34aa9193b0e35363ca2ebe00c3e32c (diff) |
tdf#107801 docx export: support w:kern
Writer only enables or disables pair kerning (autokern).
Word uses a minimum font size to determine which characters
to kern. Since these documents are round-tripping through
Writer, and every size is kerned by Writer, the minimum size is
forced to 1pt and the original minimum font size is lost.
This is a followup to commit 38b0c24fa5cbb4246e03d77ac022dfdc9fdede03
for related tdf#105454 DOCX import: fix unwanted enabled-by-default
kerning.
Tested in Word 2003, 2007, 2013.
Change-Id: I7678a544f455fd06bec5e7d864b5c27ab26bf6d3
Reviewed-on: https://gerrit.libreoffice.org/37574
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 83dfe43b5372..f82667c6ed2c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6483,9 +6483,12 @@ void DocxAttributeOutput::CharWeight( const SvxWeightItem& rWeight ) m_pSerializer->singleElementNS( XML_w, XML_b, FSNS( XML_w, XML_val ), "false", FSEND ); } -void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& ) +void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& rAutoKern ) { - SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::CharAutoKern()" ); + // auto kerning is bound to a minimum font size in Word - but is just a boolean in Writer :-( + // kerning is based on half-point sizes, so 2 enables kerning for fontsize 1pt or higher. (1 is treated as size 12, and 0 is treated as disabled.) + const OString sFontSize = OString::number( (sal_uInt32) rAutoKern.GetValue() * 2 ); + m_pSerializer->singleElementNS(XML_w, XML_kern, FSNS( XML_w, XML_val ), sFontSize.getStr(), FSEND ); } void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink ) |