diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 70ccd94..c48ee02 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7772,14 +7772,17 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT aUnicodes.push_back( rText.GetChar( sal::static_int_cast(pCharPosAry[i]) ) ); pUnicodesPerGlyph[i] = 1; // try to handle ligatures and such - if( i < nGlyphs-1 ) + if( i < nGlyphs ) { - nChars = pCharPosAry[i+1] - pCharPosAry[i]; + if( i < nGlyphs-1 ) + nChars = pCharPosAry[i+1] - pCharPosAry[i]; + else + nChars = rText.Len() - 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 ) + else if( nChars == 0 ) nChars = 1; pUnicodesPerGlyph[i] = nChars; for( int n = 1; n < nChars; n++ )