[Tizen] Fix the problem that Autoscroll does not work properly 22/317722/1
authorANZ1217 <chihun.jeong@samsung.com>
Mon, 9 Sep 2024 10:44:12 +0000 (19:44 +0900)
committerANZ1217 <chihun.jeong@samsung.com>
Fri, 13 Sep 2024 06:44:04 +0000 (15:44 +0900)
when there are only RTL Marker and LTR Text in Text.

Change-Id: I0d31811a5622ea021ce195c9fc1e1da00925ddfb

dali-toolkit/internal/text/multi-language-support-impl.cpp

index dfabf89..0b6ea1d 100644 (file)
@@ -198,6 +198,10 @@ void MultilanguageSupport::SetScripts(const Vector<Character>& text,
   // Whether the first valid script is a right to left script.
   bool isParagraphRTL = false;
 
+  // Whether there is an RTL marker in the invalid script.
+  // This variable was added to solve the problem that autoscroll does not work properly when there are only RTL Marker and LTR Text.
+  bool hasRTLMarker = false;
+
   // Count the number of characters which are valid for all scripts. i.e. white spaces or '\n'.
   Length numberOfAllScriptCharacters = 0u;
 
@@ -260,6 +264,7 @@ void MultilanguageSupport::SetScripts(const Vector<Character>& text,
     {
       // Check if whether is right to left markup and Keeps true if the previous value was true.
       currentScriptRun.isRightToLeft = currentScriptRun.isRightToLeft || TextAbstraction::IsRightToLeftMark(character);
+      hasRTLMarker = hasRTLMarker || TextAbstraction::IsRightToLeftMark(character);
 
       // Count all these characters to be added into a script.
       ++numberOfAllScriptCharacters;
@@ -359,12 +364,14 @@ void MultilanguageSupport::SetScripts(const Vector<Character>& text,
       // Adds the white spaces which are at the begining of the script.
       numberOfAllScriptCharacters++;
       AddCurrentScriptAndCreatNewScript(script,
-                                        TextAbstraction::IsRightToLeftScript(script),
+                                        hasRTLMarker ? true : TextAbstraction::IsRightToLeftScript(script),
                                         true,
                                         currentScriptRun,
                                         numberOfAllScriptCharacters,
                                         scripts,
                                         scriptIndex);
+
+      hasRTLMarker = false;
     }
     else
     {