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:23:04 +0100
commit20b54a228b2844ad66d80d930d4a9eb39ce8c336 (patch)
treef7126b268ec5adfbf6fc186593e42a4fd8cc26fe
parent45cd3f505a02ba48171bcbb8e319fedc6f868b10 (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
-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 )
{