Merge "bug fixed about the rtl markup behavior." into devel/master
authorjoogab yun <joogab.yun@samsung.com>
Fri, 14 Dec 2018 06:09:56 +0000 (06:09 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 14 Dec 2018 06:09:56 +0000 (06:09 +0000)
dali-toolkit/internal/text/bidirectional-support.cpp
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/script-run.h [changed mode: 0644->0755]

index 9f9bddc..26e99b7 100755 (executable)
@@ -148,7 +148,7 @@ void SetBidirectionalInfo( const Vector<Character>& text,
       break;
     }
 
-    if( !hasRightToLeftScript && TextAbstraction::IsRightToLeftScript( scriptRun.script ) )
+    if( !hasRightToLeftScript && scriptRun.isRightToLeft )
     {
       // The script is right to left.
       hasRightToLeftScript = true;
index 4b6eee2..607d159 100755 (executable)
@@ -204,6 +204,9 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
   // Pointers to the text buffer.
   const Character* const textBuffer = text.Begin();
 
+  // Initialize whether is right to left direction
+  currentScriptRun.isRightToLeft = false;
+
   // Traverse all characters and set the scripts.
   const Length lastCharacter = startIndex + numberOfCharacters;
   for( Length index = startIndex; index < lastCharacter; ++index )
@@ -226,6 +229,9 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
     while( !endOfText &&
            ( TextAbstraction::COMMON == script ) )
     {
+      // Check if whether is right to left markup and Keeps true if the previous value was true.
+      currentScriptRun.isRightToLeft = currentScriptRun.isRightToLeft || TextAbstraction::IsRightToLeftMark( character );
+
       if( TextAbstraction::EMOJI == currentScriptRun.script )
       {
         // Emojis doesn't mix well with characters common to all scripts. Insert the emoji run.
@@ -262,6 +268,8 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
         currentScriptRun.characterRun.numberOfCharacters = 0u;
         currentScriptRun.script = TextAbstraction::UNKNOWN;
         numberOfAllScriptCharacters = 0u;
+        // Initialize whether is right to left direction
+        currentScriptRun.isRightToLeft = false;
       }
 
       // Get the next character.
@@ -288,7 +296,7 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
         ( TextAbstraction::EMOJI != script ) )
     {
       // Sets the direction of the first valid script.
-      isParagraphRTL = TextAbstraction::IsRightToLeftScript( script );
+      isParagraphRTL = currentScriptRun.isRightToLeft || TextAbstraction::IsRightToLeftScript( script );
       isFirstScriptToBeSet = false;
     }
 
@@ -332,6 +340,8 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
       currentScriptRun.characterRun.numberOfCharacters = numberOfAllScriptCharacters + 1u; // Adds the white spaces which are at the begining of the script.
       currentScriptRun.script = script;
       numberOfAllScriptCharacters = 0u;
+      // Check if whether is right to left script.
+      currentScriptRun.isRightToLeft = TextAbstraction::IsRightToLeftScript( currentScriptRun.script );
     }
     else
     {
old mode 100644 (file)
new mode 100755 (executable)
index 3533df6..3f6b678
@@ -37,6 +37,7 @@ struct ScriptRun
 {
   CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
   Script       script;       ///< Script of the run.
+  bool         isRightToLeft; ///< Whether is right to left direction
 };
 
 } // namespace Text