summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-12-07 15:22:24 +0100
committerEike Rathke <erack@redhat.com>2016-12-07 15:59:03 +0000
commit1cbc37454055717430bafd78e92b657fc2bbbc4f (patch)
treef668710a18f4c03b615ad99422e7a7e6425617a4
parent0a5dccacc37338abf22785fe0a196dbad0691b0d (diff)
stab at the sick "units in character width of the standard font", tdf#101363
Which gave problems in the unit test on tinderbox build machines, apparently because they don't have not even the resulting fallback font installed. Specifically here digit '1' was slightly wider (123) than digit '0' (122), which the import accounts for but the export didn't, so widths were divided by 122 instead of 123 hence resulted in 24.23 instead of 24, for example. Change-Id: If8a04383632de674ae2a15a79608661e434aeb54 (cherry picked from commit 20b54a228b2844ad66d80d930d4a9eb39ce8c336) Reviewed-on: https://gerrit.libreoffice.org/31729 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sc/source/filter/excel/xlroot.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 97ece71e8236..cef5e3886a38 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -205,7 +205,11 @@ void XclRoot::SetCharWidth( const XclFontData& rFontData )
aFont.SetCharSet( rFontData.GetFontEncoding() );
aFont.SetWeight( rFontData.GetScWeight() );
pPrinter->SetFont( aFont );
- mrData.mnCharWidth = pPrinter->GetTextWidth( OUString('0') );
+ // Usually digits have the same width, but in some fonts they don't ...
+ // Match the import in sc/source/filter/oox/unitconverter.cxx
+ // UnitConverter::finalizeImport()
+ for (sal_Unicode cChar = '0'; cChar <= '9'; ++cChar)
+ mrData.mnCharWidth = std::max( pPrinter->GetTextWidth( OUString(cChar)), mrData.mnCharWidth);
}
if( mrData.mnCharWidth <= 0 )
{