diff -ur ooo_OOD680_m5_src.orig/vcl/source/gdi/sallayout.cxx ooo_OOD680_m5_src/vcl/source/gdi/sallayout.cxx --- ooo_OOD680_m5_src.orig/vcl/source/gdi/sallayout.cxx 2006-09-29 22:22:00.000000000 +0200 +++ ooo_OOD680_m5_src/vcl/source/gdi/sallayout.cxx 2006-09-29 22:24:58.000000000 +0200 @@ -1063,7 +1063,8 @@ n = pG->mnCharPos - rArgs.mnMinCharPos; if( (n < 0) || (nCharCount <= n) ) continue; - pLogCluster[ n ] = i; + if( pLogCluster[ n ] < 0 ) + pLogCluster[ n ] = i; if( nBasePointX < 0 ) nBasePointX = pG->maLinearPos.X(); } @@ -1765,20 +1766,23 @@ } } - // if a justification array is available => override the advance width + // if a justification array is available + // => use it directly to advance to the next x-position if( aMultiArgs.mpDXArray ) { // the run advance is the width from the first char // in the run to the first char in the next run nRunAdvance = 0; - int nRelPos = nCharPos[0] - mnMinCharPos; - if( nRelPos > 0 ) - nRunAdvance += aMultiArgs.mpDXArray[ nRelPos-1 ]; - nRelPos = nActiveCharPos - mnMinCharPos; - if( nRelPos > 0 ) - nRunAdvance -= aMultiArgs.mpDXArray[ nRelPos-1 ]; - if( nRunAdvance < 0 ) + const bool bLTR = (nActiveCharPos < nCharPos[0]); + int nDXIndex = nCharPos[0] - mnMinCharPos - bLTR; + if( nDXIndex >= 0 ) + nRunAdvance += aMultiArgs.mpDXArray[ nDXIndex ]; + nDXIndex = nActiveCharPos - mnMinCharPos - bLTR; + if( nDXIndex >= 0 ) + nRunAdvance -= aMultiArgs.mpDXArray[ nDXIndex ]; + if( !bLTR ) nRunAdvance = -nRunAdvance; + // convert justification array units into fallback font units nRunAdvance *= mpLayouts[n]->GetUnitsPerPixel(); }