[Tizen] Fix the problem that Autoscroll does not work properly 23/317723/1 accepted/tizen/8.0/unified/20240924.162414
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:46:48 +0000 (15:46 +0900)
when there are only RTL Marker and LTR Text in Text.

Change-Id: I644ee6f88367d7f0fe2190ae2425414bbad4a7d9

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

index 1b3d0ced77192777fefdc34fdaa773b7b8f1af64..205424f96ebb0ab8a19c7a08249ce515ab4dca44 100644 (file)
@@ -372,6 +372,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;
 
@@ -434,6 +438,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;
@@ -533,12 +538,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
     {