diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-06-05 23:47:13 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-06-06 15:17:15 +0200 |
commit | 5471a5585cba925bb0dcb2dc41e03ad563998166 (patch) | |
tree | 88a2c88ead2b82a00a62caa238d5733054c25e53 /writerfilter | |
parent | 581f748e1e8056f08eb803638a4ffb118a57e911 (diff) |
tdf#108350: Use Carlito for DOCX import by default
In OOXML (i.e. Word since 2007), the default document font is Calibri
11 pt. If a document doesn't contain font information, we should assume
our metric-compatible equivalent Carlito to provide best layout match.
A unit test included.
An existing unit test (testN766487) was corrected to match the font
size that Word uses (11; was 12 which doesn't match Word's size).
Change-Id: I3040f235696282dc7a124cd83fb34a6d95a29a17
Reviewed-on: https://gerrit.libreoffice.org/38421
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 5928fa4315c4..3abdb8d2b6f9 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -134,6 +134,24 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon SAL_WARN("writerfilter", "DomainMapper::DomainMapper: failed to initialize RDF metadata: " << rException.Message); } + if (eDocumentType == SourceDocumentType::OOXML) { + // tdf#108350 + // In OOXML (i.e. Word since 2007), the default document font is Calibri 11 pt. + // If a document doesn't contain font information, we should assume our + // metric-compatible equivalent Carlito to provide best layout match. + try + { + uno::Reference< beans::XPropertySet > xDefProps(GetTextFactory()->createInstance("com.sun.star.text.Defaults"), + uno::UNO_QUERY_THROW); + xDefProps->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), css::uno::Any(OUString("Carlito"))); + xDefProps->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), css::uno::Any(double(11))); + } + catch (const uno::Exception& rException) + { + SAL_WARN("writerfilter", "DomainMapper::DomainMapper: failed to initialize default font: " << rException.Message); + } + } + //import document properties try { |