Sorts text sequences in LTR and RTL by system language direction. 61/191961/11
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 23 Oct 2018 08:56:45 +0000 (17:56 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Fri, 2 Nov 2018 00:31:09 +0000 (00:31 +0000)
if matchSystemLanguageDirection property set true,
The text order follows the system language direction.

Change-Id: I43c1dc894d6a216f97366a4c339529c04ac92cb4

dali/devel-api/text-abstraction/bidirectional-support.cpp [changed mode: 0644->0755]
dali/devel-api/text-abstraction/bidirectional-support.h
dali/internal/text/text-abstraction/bidirectional-support-impl.cpp [changed mode: 0644->0755]
dali/internal/text/text-abstraction/bidirectional-support-impl.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index b60f896..79389ae
@@ -46,10 +46,14 @@ BidirectionalSupport BidirectionalSupport::Get()
 }
 
 BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph,
-                                                Length numberOfCharacters )
+                                                Length numberOfCharacters,
+                                                bool matchSystemLanguageDirection,
+                                                LayoutDirection::Type layoutDirection )
 {
   return GetImplementation( *this ).CreateInfo( paragraph,
-                                                numberOfCharacters );
+                                                numberOfCharacters,
+                                                matchSystemLanguageDirection,
+                                                layoutDirection );
 }
 
 void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex )
index 55ba1f9..142cdab 100755 (executable)
@@ -23,6 +23,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/actors/actor-enumerations.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-adaptor-common.h>
@@ -81,11 +82,14 @@ public:
    *
    * @param[in] paragraph Pointer to the first character of the paragraph coded in UTF32.
    * @param[in] numberOfCharacters The number of characters of the paragraph.
-   *
+   * @param[in] matchSystemLanguageDirection Whether match for system language direction or not.
+   * @param[in] layoutDirection The direction of the system language.
    * @return An index of an object inside a table storing the bidirectional data.
    */
   BidiInfoIndex CreateInfo( const Character* const paragraph,
-                            Length numberOfCharacters );
+                            Length numberOfCharacters,
+                            bool matchSystemLanguageDirection,
+                            LayoutDirection::Type layoutDirection );
 
   /**
    * @brief Destroys the bidirectional data.
old mode 100644 (file)
new mode 100755 (executable)
index 5d096c3..29bd3b9
@@ -126,7 +126,9 @@ struct BidirectionalSupport::Plugin
   }
 
   BidiInfoIndex CreateInfo( const Character* const paragraph,
-                            Length numberOfCharacters )
+                            Length numberOfCharacters,
+                            bool matchSystemLanguageDirection,
+                            LayoutDirection::Type layoutDirection )
   {
     // Reserve memory for the paragraph's bidirectional info.
     BidirectionalInfo* bidirectionalInfo = new BidirectionalInfo();
@@ -150,7 +152,9 @@ struct BidirectionalSupport::Plugin
     fribidi_get_bidi_types( paragraph, numberOfCharacters, bidirectionalInfo->characterTypes );
 
     // Retrieve the paragraph's direction.
-    bidirectionalInfo->paragraphDirection = fribidi_get_par_direction( bidirectionalInfo->characterTypes, numberOfCharacters );
+    bidirectionalInfo->paragraphDirection = matchSystemLanguageDirection == true ?
+                                           ( layoutDirection == LayoutDirection::RIGHT_TO_LEFT ? FRIBIDI_PAR_RTL : FRIBIDI_PAR_LTR ) :
+                                           ( fribidi_get_par_direction( bidirectionalInfo->characterTypes, numberOfCharacters ) );
 
     // Retrieve the embedding levels.
     if (fribidi_get_par_embedding_levels( bidirectionalInfo->characterTypes, numberOfCharacters, &bidirectionalInfo->paragraphDirection, bidirectionalInfo->embeddedLevels ) == 0)
@@ -390,12 +394,16 @@ TextAbstraction::BidirectionalSupport BidirectionalSupport::Get()
 }
 
 BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph,
-                                                Length numberOfCharacters )
+                                                Length numberOfCharacters,
+                                                bool matchSystemLanguageDirection,
+                                                Dali::LayoutDirection::Type layoutDirection )
 {
   CreatePlugin();
 
   return mPlugin->CreateInfo( paragraph,
-                              numberOfCharacters );
+                              numberOfCharacters,
+                              matchSystemLanguageDirection,
+                              layoutDirection );
 }
 
 void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex )
old mode 100644 (file)
new mode 100755 (executable)
index ab180c2..8964856
@@ -60,7 +60,9 @@ public:
    * @copydoc Dali::BidirectionalSupport::CreateInfo()
    */
   BidiInfoIndex CreateInfo( const Character* const paragraph,
-                            Length numberOfCharacters );
+                            Length numberOfCharacters,
+                            bool matchSystemLanguageDirection,
+                            LayoutDirection::Type layoutDirection );
 
   /**
    * @copydoc Dali::BidirectionalSupport::DestroyInfo()