Commits

Anonymous committed 9284170

#i115618# fix bad PDF export regression for simple RTL cases

Comments (0)

Files changed (1)

vcl/source/gdi/pdfwriter_impl.cxx

                 // try to handle ligatures and such
                 if( i < nGlyphs-1 )
                 {
-                    pUnicodesPerGlyph[i] = nChars = pCharPosAry[i+1] - pCharPosAry[i];
+                    nChars = pCharPosAry[i+1] - pCharPosAry[i];
+                    // #i115618# fix for simple RTL+CTL cases	
+                    // TODO: sanitize for RTL ligatures, more complex CTL, etc.	
+                    if( nChars < 0 )
+                        nChars = -nChars;		    
+		    else if( nChars == 0 )
+                        nChars = 1;		    
+                    pUnicodesPerGlyph[i] = nChars;
                     for( int n = 1; n < nChars; n++ )
                         aUnicodes.push_back( rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]+n) ) );
                 }