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 21:05:55 +0000
commiteb7d2f4e15badd36d464c89bdc3ce679f6d30c59 (patch)
treecaeb553e91e0219e693eddf1a27f92d85d658d2a
parent6e292a8a5a9e4dd8db68ce02643d1994d9759ce5 (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/31728 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-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 46d9d28c2ad8..092ca1afcea9 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 )
{