include/vcl/outdev.hxx              |    2 ++
 sw/source/core/txtnode/fntcache.cxx |   34 +++++++++++++++++++++++++---------
 vcl/source/outdev/text.cxx          |    5 +++++
 3 files changed, 32 insertions(+), 9 deletions(-)

New commits:
commit 2a923986349ab3dd765f1dc5890cf98ee4e6deac
Author: Khaled Hosny <[email protected]>
Date:   Sun Feb 19 22:21:40 2017 +0200

    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 <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 4f8edca85216b46b266fc5dba3103da57e5975be)
    Reviewed-on: https://gerrit.libreoffice.org/34677
    Reviewed-by: Khaled Hosny <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Reviewed-by: Christian Lohmaier <[email protected]>
    Tested-by: Christian Lohmaier <[email protected]>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 0088136..1bf5229 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 a92fb87..70be938 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 0506280..60917ce 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: */
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to