Makes the LTR/RTL alignment of text follow the system language by default. 70/259870/3
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 16 Jun 2021 07:18:43 +0000 (16:18 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Tue, 6 Jul 2021 01:51:28 +0000 (01:51 +0000)
The MATCH_SYSTEM_LANGUAGE_DIRECTION property defaults to true.

When the layout direction of TextLabel, TextField, or TextEditor is changed,
LTR/RTL alignment of text follows the layout direction of each control.

If you set MATCH_SYSTEM_LANGUAGE_DIRECTION to false
As before, LTR/RTL is determined according to the language of the text.

Change-Id: If92e44feb942cf3024bbe56842d75b2b45a73448

dali/devel-api/text-abstraction/bidirectional-support.cpp
dali/devel-api/text-abstraction/bidirectional-support.h
dali/internal/text/text-abstraction/bidirectional-support-impl.cpp
dali/internal/text/text-abstraction/bidirectional-support-impl.h

index f7e3e2f..4d7279c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,12 +45,12 @@ BidirectionalSupport BidirectionalSupport::Get()
 
 BidiInfoIndex BidirectionalSupport::CreateInfo(const Character* const paragraph,
                                                Length                 numberOfCharacters,
-                                               bool                   matchSystemLanguageDirection,
+                                               bool                   matchLayoutDirection,
                                                LayoutDirection::Type  layoutDirection)
 {
   return GetImplementation(*this).CreateInfo(paragraph,
                                              numberOfCharacters,
-                                             matchSystemLanguageDirection,
+                                             matchLayoutDirection,
                                              layoutDirection);
 }
 
index ac4b9da..d76a2bd 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -77,13 +77,13 @@ 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.
+   * @param[in] matchLayoutDirection Whether match for layout direction or not.
+   * @param[in] layoutDirection The direction of the layout direction.
    * @return An index of an object inside a table storing the bidirectional data.
    */
   BidiInfoIndex CreateInfo(const Character* const paragraph,
                            Length                 numberOfCharacters,
-                           bool                   matchSystemLanguageDirection,
+                           bool                   matchLayoutDirection,
                            LayoutDirection::Type  layoutDirection);
 
   /**
index e6b9cd8..a451de9 100644 (file)
@@ -125,7 +125,7 @@ struct BidirectionalSupport::Plugin
 
   BidiInfoIndex CreateInfo(const Character* const paragraph,
                            Length                 numberOfCharacters,
-                           bool                   matchSystemLanguageDirection,
+                           bool                   matchLayoutDirection,
                            LayoutDirection::Type  layoutDirection)
   {
     // Reserve memory for the paragraph's bidirectional info.
@@ -150,7 +150,7 @@ struct BidirectionalSupport::Plugin
     fribidi_get_bidi_types(paragraph, numberOfCharacters, bidirectionalInfo->characterTypes);
 
     // Retrieve the paragraph's direction.
-    bidirectionalInfo->paragraphDirection = matchSystemLanguageDirection == true ? (layoutDirection == LayoutDirection::RIGHT_TO_LEFT ? FRIBIDI_PAR_RTL : FRIBIDI_PAR_LTR) : (fribidi_get_par_direction(bidirectionalInfo->characterTypes, numberOfCharacters));
+    bidirectionalInfo->paragraphDirection = matchLayoutDirection == 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)
@@ -391,14 +391,14 @@ TextAbstraction::BidirectionalSupport BidirectionalSupport::Get()
 
 BidiInfoIndex BidirectionalSupport::CreateInfo(const Character* const      paragraph,
                                                Length                      numberOfCharacters,
-                                               bool                        matchSystemLanguageDirection,
+                                               bool                        matchLayoutDirection,
                                                Dali::LayoutDirection::Type layoutDirection)
 {
   CreatePlugin();
 
   return mPlugin->CreateInfo(paragraph,
                              numberOfCharacters,
-                             matchSystemLanguageDirection,
+                             matchLayoutDirection,
                              layoutDirection);
 }
 
index 03c7faa..e290f4f 100644 (file)
@@ -57,7 +57,7 @@ public:
    */
   BidiInfoIndex CreateInfo(const Character* const paragraph,
                            Length                 numberOfCharacters,
-                           bool                   matchSystemLanguageDirection,
+                           bool                   matchLayoutDirection,
                            LayoutDirection::Type  layoutDirection);
 
   /**