diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-04-02 16:29:53 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-08 14:42:18 +0000 |
commit | 598329f0450df98672ef30fc0f08aa718b8f3fcd (patch) | |
tree | 0d1cde533313d524f2575024c4e7e3d73e864abb | |
parent | 6c51365d7062d5aaa5b6e0f6e7c7fbfd2a9ebda6 (diff) |
Resolves: tdf#86399 don't clobber cluster start caret pos
with other cluster element bounds
(cherry picked from commit b1030f75d3e47719ca63ec518f1da75196bead1a)
Conflicts:
vcl/source/gdi/sallayout.cxx
Change-Id: I2cc976eb6a0ef42a2678be80637c7220e2247921
Reviewed-on: https://gerrit.libreoffice.org/15121
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 20a0ff656e31..ee06017a2f1f 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1251,19 +1251,20 @@ void GenericSalLayout::KashidaJustify( long nKashidaIndex, int nKashidaWidth ) void GenericSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray ) const { // initialize result array - long nXPos = -1; - int i; - for( i = 0; i < nMaxIndex; ++i ) - pCaretXArray[ i ] = nXPos; + for (int i = 0; i < nMaxIndex; ++i) + pCaretXArray[i] = -1; // calculate caret positions using glyph array for( GlyphVector::const_iterator pG = m_GlyphItems.begin(), pGEnd = m_GlyphItems.end(); pG != pGEnd; ++pG ) { - nXPos = pG->maLinearPos.X(); + long nXPos = pG->maLinearPos.X(); long nXRight = nXPos + pG->mnOrigWidth; int n = pG->mnCharPos; int nCurrIdx = 2 * (n - mnMinCharPos); - if( !pG->IsRTLGlyph() ) + // tdf#86399 if this is not the start of a cluster, don't overwrite the caret bounds of the cluster start + if (!pG->IsClusterStart() && pCaretXArray[nCurrIdx] != -1) + continue; + if (!pG->IsRTLGlyph()) { // normal positions for LTR case pCaretXArray[ nCurrIdx ] = nXPos; |