From d6e64b3378155f98076a5a92e70fd17153d431b5 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Wed, 16 Jun 2021 16:18:43 +0900 Subject: [PATCH] Makes the LTR/RTL alignment of text follow the system language by default. 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 | 6 +++--- dali/devel-api/text-abstraction/bidirectional-support.h | 8 ++++---- .../internal/text/text-abstraction/bidirectional-support-impl.cpp | 8 ++++---- dali/internal/text/text-abstraction/bidirectional-support-impl.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dali/devel-api/text-abstraction/bidirectional-support.cpp b/dali/devel-api/text-abstraction/bidirectional-support.cpp index f7e3e2f..4d7279c 100644 --- a/dali/devel-api/text-abstraction/bidirectional-support.cpp +++ b/dali/devel-api/text-abstraction/bidirectional-support.cpp @@ -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); } diff --git a/dali/devel-api/text-abstraction/bidirectional-support.h b/dali/devel-api/text-abstraction/bidirectional-support.h index ac4b9da..d76a2bd 100644 --- a/dali/devel-api/text-abstraction/bidirectional-support.h +++ b/dali/devel-api/text-abstraction/bidirectional-support.h @@ -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); /** diff --git a/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp b/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp index e6b9cd8..a451de9 100644 --- a/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp +++ b/dali/internal/text/text-abstraction/bidirectional-support-impl.cpp @@ -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); } diff --git a/dali/internal/text/text-abstraction/bidirectional-support-impl.h b/dali/internal/text/text-abstraction/bidirectional-support-impl.h index 03c7faa..e290f4f 100644 --- a/dali/internal/text/text-abstraction/bidirectional-support-impl.h +++ b/dali/internal/text/text-abstraction/bidirectional-support-impl.h @@ -57,7 +57,7 @@ public: */ BidiInfoIndex CreateInfo(const Character* const paragraph, Length numberOfCharacters, - bool matchSystemLanguageDirection, + bool matchLayoutDirection, LayoutDirection::Type layoutDirection); /** -- 2.7.4