summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2015-11-21 23:14:18 +0800
committerMark Hung <marklh9@gmail.com>2015-12-19 12:38:46 +0000
commite32fd5e8671b787dfc6795f3109c616974fe2594 (patch)
treebaa98cc3a936549bd3316923de5529cf5c82c4b1 /sw/source
parentdd258f168f7e5952a71d84a2564c3d5162a613c8 (diff)
tdf#83755 correct non-printing character position
Bullet of non-monospace font that is used as non-printing character to indicate space might be wider than the space. Drawing the bullet over the space make the bullet too close to next character. Shift the bullet accordingly so that bullet is centered with original space. Change-Id: I0d8d721041e8a475546fe25fb01bee374fc3e499 Reviewed-on: https://gerrit.libreoffice.org/20112 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/txtnode/fntcache.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index f8189328cff6..1b5ebbde0ade 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1781,6 +1781,28 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
pTmpFont->SetOverline(UNDERLINE_NONE);
pTmpFont->SetStrikeout(STRIKEOUT_NONE);
rInf.GetOut().SetFont( *pTmpFont );
+ long nShift = rInf.GetOut( ).GetFontMetric( ).GetBulletOffset( );
+ if ( nShift )
+ {
+ long nAdd = 0;
+
+ if (aBulletOverlay.getLength() > nTmpIdx &&
+ aBulletOverlay[ nTmpIdx ] == CH_BULLET )
+ {
+ if (bSwitchH2V)
+ aTextOriginPos.Y() += nShift ;
+ else
+ aTextOriginPos.X() += nShift ;
+ nAdd = nShift ;
+ }
+ for( sal_Int32 i = 1 ; i < nLen ; ++i )
+ {
+ if ( aBulletOverlay[ i + nTmpIdx ] == CH_BULLET )
+ pKernArray [ i - 1 ] += nShift ;
+ if ( nAdd )
+ pKernArray [ i - 1 ] -= nAdd;
+ }
+ }
rInf.GetOut().DrawTextArray( aTextOriginPos, aBulletOverlay, pKernArray + nOffs,
nTmpIdx + nOffs , nLen - nOffs );
pTmpFont->SetColor( aPreviousColor );