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 f7e3e2fa6bbbaa80eadf196444e61f19af239e78..4d7279cffbcf66a4467338321d184dcd795b67ad 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 ac4b9da7ac45bba25ed0b60a1da7b3e9a6214ae3..d76a2bdba824d526068b0f4283e2eb1878705126 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 e6b9cd87c489d1e0aec6a0422c6bcc7916bfbc38..a451de9207816cf10d667e936f5d7659c24ddaaf 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 03c7faaa06795d76732f1185155b3b4194a1bdd2..e290f4f2c11b34e5b9616dd377caf73caac25411 100644 (file)
@@ -57,7 +57,7 @@ public:
    */
   BidiInfoIndex CreateInfo(const Character* const paragraph,
                            Length                 numberOfCharacters,
-                           bool                   matchSystemLanguageDirection,
+                           bool                   matchLayoutDirection,
                            LayoutDirection::Type  layoutDirection);
 
   /**