diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2017-02-19 22:21:40 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-03-07 20:15:14 +0000 |
commit | 2a923986349ab3dd765f1dc5890cf98ee4e6deac (patch) | |
tree | 60818a9a85eec65730800392ee6fdcd18b6fa8e3 | |
parent | d54a0671146138bff0e6b0700e17e79f90d53d47 (diff) |
tdf#106096: Fix visible space on Mac with the new layout engine
This is not an issue on master since the alternative Mac code path is
gone, but we need to skip it in 5.3 when the old layout engine is not
used as well.
Change-Id: Ib0c8fcf072229c59e15877815c9d88aed94672f0
Reviewed-on: https://gerrit.libreoffice.org/34433
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 4f8edca85216b46b266fc5dba3103da57e5975be)
Reviewed-on: https://gerrit.libreoffice.org/34677
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | include/vcl/outdev.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 34 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 5 |
3 files changed, 32 insertions, 9 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 0088136ca734..1bf52296ea43 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1172,6 +1172,8 @@ public: vcl::TextLayoutCache const* = nullptr) const; std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&) const; + static bool UseCommonLayout(); + private: SAL_DLLPRIVATE void ImplInitTextColor(); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index a92fb879f2df..70be938edce2 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1384,10 +1384,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { const OUString* pStr = &rInf.GetText(); -#if !defined(MACOSX) && !defined(IOS) OUString aStr; OUString aBulletOverlay; -#endif + bool bBullet = rInf.GetBullet(); if( m_bSymbol ) bBullet = false; @@ -1492,8 +1491,11 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) nScrPos = pScrArray[ 0 ]; -#if !defined(MACOSX) && !defined(IOS) - if( bBullet ) + if( bBullet +#if defined(MACOSX) || defined(IOS) + && OutputDevice::UseCommonLayout() +#endif + ) { // !!! HACK !!! // The Arabic layout engine requires some context of the string @@ -1532,7 +1534,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BLANK)); } } -#endif + sal_Int32 nCnt = rInf.GetText().getLength(); if ( nCnt < rInf.GetIdx() ) nCnt = 0; @@ -1557,14 +1559,21 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos ); #if defined(MACOSX) || defined(IOS) - rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), + if (!OutputDevice::UseCommonLayout()) + { + rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), pKernArray, rInf.GetIdx(), 1, bBullet ? SalLayoutFlags::DrawBullet : SalLayoutFlags::NONE ); -#else + } + else + { +#endif rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), pKernArray, rInf.GetIdx(), 1 ); if( bBullet ) rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray, rInf.GetIdx() ? 1 : 0, 1 ); +#if defined(MACOSX) || defined(IOS) + } #endif } else @@ -1747,9 +1756,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) rInf.GetFrame()->SwitchHorizontalToVertical( aTextOriginPos ); #if defined(MACOSX) || defined(IOS) - rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray + nOffs, + if (!OutputDevice::UseCommonLayout()) + { + rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray + nOffs, rInf.GetIdx() + nOffs , nLen - nOffs, bBullet ? SalLayoutFlags::DrawBullet : SalLayoutFlags::NONE ); -#else + } + else + { +#endif // If we paint bullets instead of spaces, we use a copy of // the paragraph string. For the layout engine, the copy // of the string has to be an environment of the range which @@ -1804,6 +1818,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) pTmpFont->SetStrikeout(aPreviousStrikeout); rInf.GetOut().Pop(); } +#if defined(MACOSX) || defined(IOS) + } #endif } } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 05062801cf19..60917ce0d98f 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -2903,4 +2903,9 @@ bool OutputDevice::GetTextOutline( tools::PolyPolygon& rPolyPoly, const OUString return true; } +bool OutputDevice::UseCommonLayout() +{ + return SalLayout::UseCommonLayout(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |