[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jan 27 06:27:42 PST 2015


 vcl/source/gdi/pdfwriter_impl.cxx |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

New commits:
commit 81ad8d3642b119734708fa515714aed37003ec90
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 26 20:35:48 2015 +0000

    Resolves: rhbz#1177022 no width set on space glyph with CM Typewriter fonts
    
    Change-Id: I0dfb044b8a339fa6c473e42f31fc28c200cd03ea
    (cherry picked from commit 37dc4bdbf25847c95f1668553dbae3e2dc885816)
    Reviewed-on: https://gerrit.libreoffice.org/14206
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 2f44dd5..6d8b9be 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3083,15 +3083,24 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
         memset( pEncToUnicodeIndex, 0, sizeof(pEncToUnicodeIndex) );
         for( Ucs2SIntMap::const_iterator it = pEncoding->begin(); it != pEncoding->end(); ++it )
         {
-            if( it->second != -1 )
-            {
-                sal_Int32 nCode = (sal_Int32)(it->second & 0x000000ff);
-                nEncoding[ nCode ] = static_cast<sal_uInt8>( nCode );
-                nEncodedCodes[ nCode ] = it->first;
-                pEncToUnicodeIndex[ nCode ] = static_cast<sal_Int32>(aUnicodes.size());
-                aUnicodes.push_back( it->first );
-                pUnicodesPerGlyph[ nCode ] = 1;
-            }
+            if(it->second == -1)
+                continue;
+            sal_Int32 nCode = (sal_Int32)(it->second & 0x000000ff);
+            //We're not doing this right here. We have taken a unicode-to-font_index map
+            //and are trying to generate a font_index-to-unicode mapping from it
+            //Which assumes that there is a 1-to-1 mapping there, but that might not be
+            //true.
+            //
+            //Instead perhaps we could try and get the GetFontCharMap and loop
+            //over sal_UCS4 GetCharFromIndex( int nCharIndex ) const from 0 to 255
+            //to build it up
+            if (nEncodedCodes[nCode] != 0)
+                continue;
+            nEncodedCodes[ nCode ] = it->first;
+            nEncoding[ nCode ] = static_cast<sal_uInt8>( nCode );
+            pEncToUnicodeIndex[ nCode ] = static_cast<sal_Int32>(aUnicodes.size());
+            aUnicodes.push_back( it->first );
+            pUnicodesPerGlyph[ nCode ] = 1;
         }
     }
 


More information about the Libreoffice-commits mailing list