[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/source

Eike Rathke erack at redhat.com
Wed Dec 7 21:06:24 UTC 2016


 sc/source/filter/excel/xlroot.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit eb7d2f4e15badd36d464c89bdc3ce679f6d30c59
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Dec 7 15:22:24 2016 +0100

    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 at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 46d9d28..092ca1a 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 )
     {


More information about the Libreoffice-commits mailing list