[Libreoffice-commits] core.git: editeng/source

Khaled Hosny khaledhosny at eglug.org
Thu Mar 8 00:02:36 UTC 2018


 editeng/source/editeng/impedit2.cxx |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

New commits:
commit 7a683c31e090e5a81debadcef025df9cd61c75f0
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Wed Mar 7 23:29:15 2018 +0200

    tdf#116157: Always apply Unicode Bidi in editeng
    
    Similar to commit 270d6db63d933b7350dc8543b9b9ebc2133a116e which fixed
    the same issue in Writer. Surely having two text engines duplicating the
    same bugs sounded like a brilliant idea to someone.
    
    Change-Id: If85315fb00a2c0be78d502df0bfb9b50d9191368
    Reviewed-on: https://gerrit.libreoffice.org/50921
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index a79595251755..227ceba90dba 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1909,19 +1909,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
     WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos;
     rInfos.clear();
 
-    bool bCTL = false;
-    ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
-    for (ScriptTypePosInfo & rType : rTypes)
-    {
-        if ( rType.nScriptType == i18n::ScriptType::COMPLEX )
-           {
-            bCTL = true;
-            break;
-        }
-    }
-
-    const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
-    if ( ( bCTL || ( nBidiLevel == 1 /*RTL*/ ) ) && pParaPortion->GetNode()->Len() )
+    if (pParaPortion->GetNode()->Len())
     {
         const OUString aText = pParaPortion->GetNode()->GetString();
 
@@ -1931,6 +1919,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
         UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError );
         nError = U_ZERO_ERROR;
 
+        const UBiDiLevel nBidiLevel = IsRightToLeft(nPara) ? 1 /*RTL*/ : 0 /*LTR*/;
         ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, nullptr, &nError );
         nError = U_ZERO_ERROR;
 
@@ -1954,7 +1943,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
         ubidi_close( pBidi );
     }
 
-    // No infos mean no CTL and default dir is L2R...
+    // No infos mean ubidi error, default to LTR
     if ( rInfos.empty() )
         rInfos.emplace_back( 0, 0, pParaPortion->GetNode()->Len() );
 


More information about the Libreoffice-commits mailing list