}
return bidirectionalSupportHandle;
}
- BidiInfoIndex CreateInfo( const Character* const paragraph, Length numberOfCharacters ){return 0;}
+ BidiInfoIndex CreateInfo( const Character* const paragraph, Length numberOfCharacters,
+ bool matchSystemLanguageDirection, LayoutDirection::Type layoutDirection ){return 0;}
void DestroyInfo( BidiInfoIndex bidiInfoIndex )
{
}
BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph,
- Length numberOfCharacters )
+ Length numberOfCharacters,
+ bool matchSystemLanguageDirection,
+ LayoutDirection::Type layoutDirection )
{
- return GetImplementation( *this ).CreateInfo( paragraph, numberOfCharacters );
+ return GetImplementation( *this ).CreateInfo( paragraph, numberOfCharacters, matchSystemLanguageDirection, layoutDirection );
}
void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex )
mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT );
mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT );
+ // Sets layoutDirection value
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+ mController->SetLayoutDirection( layoutDirection );
+
// Forward input events to controller
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT );
mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT );
+ // Sets layoutDirection value
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+ mController->SetLayoutDirection( layoutDirection );
+
// Forward input events to controller
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
// Enable the text ellipsis.
mController->SetTextElideEnabled( true ); // If false then text larger than control will overflow
+ // Sets layoutDirection value
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+ mController->SetLayoutDirection( layoutDirection );
+
Layout::Engine& engine = mController->GetLayoutEngine();
engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
}
const Vector<LineBreakInfo>& lineBreakInfo,
CharacterIndex startIndex,
Length numberOfCharacters,
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo )
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ bool matchSystemLanguageDirection,
+ Dali::LayoutDirection::Type layoutDirection )
{
// Find where to insert the new paragraphs.
BidirectionalRunIndex bidiInfoIndex = 0u;
// Create the bidirectional info for the whole paragraph and store the index to the table with this info in the run.
bidirectionalRun.bidirectionalInfoIndex = bidirectionalSupport.CreateInfo( textBuffer + bidirectionalRun.characterRun.characterIndex,
- bidirectionalRun.characterRun.numberOfCharacters );
+ bidirectionalRun.characterRun.numberOfCharacters,
+ matchSystemLanguageDirection,
+ layoutDirection );
bidirectionalInfo.Insert( bidirectionalInfo.Begin() + bidiInfoIndex, bidirectionalRun );
++bidiInfoIndex;
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/actors/actor-enumerations.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
* @param[in] startIndex The character from where the bidirectional info is set.
* @param[in] numberOfCharacters The number of characters.
* @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
+ * @param[in] matchSystemLanguageDirection Whether match for system language direction or not.
+ * @param[in] layoutDirection The direction of the system language.
*/
void SetBidirectionalInfo( const Vector<Character>& text,
const Vector<ScriptRun>& scripts,
const Vector<LineBreakInfo>& lineBreakInfo,
CharacterIndex startIndex,
Length numberOfCharacters,
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ bool matchSystemLanguageDirection = false,
+ Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT );
/**
* Sets the visual to logical map tables.
lineBreakInfo,
startIndex,
requestedNumberOfCharacters,
- bidirectionalInfo );
+ bidirectionalInfo,
+ mModel->mMatchSystemLanguageDirection,
+ mLayoutDirection );
if( 0u != bidirectionalInfo.Count() )
{
mImpl->mModel->mMatchSystemLanguageDirection = match;
}
+void Controller::SetLayoutDirection( Dali::LayoutDirection::Type layoutDirection )
+{
+ mImpl->mLayoutDirection = layoutDirection;
+}
+
void Controller::SetLineWrapMode( Text::LineWrap::Mode lineWrapMode )
{
*/
void SetMatchSystemLanguageDirection( bool match );
+ /**
+ * @brief Sets layoutDirection value
+ * @param[in] layoutDirection The value of system language direction
+ */
+ void SetLayoutDirection( Dali::LayoutDirection::Type layoutDirection );
+
+
public: // Relayout.
/**
-The text's alignment can be modified to match the direction of the system language.
+The text's alignment and order can be modified to match the direction of the system language.
-If the MATCH_SYSTEM_LANGUAGE_DIRECTION property is set to true then the direction of the text is ignored, instead the text is aligned as the system default language.
+If the MATCH_SYSTEM_LANGUAGE_DIRECTION property is set to true then the direction of the text is ignored, instead the text is aligned and ordered as the system default language.
~~~{.cpp}
// C++
-label.SetProperty( TextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
+label.SetProperty( Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
~~~
~~~{.js}
| | |
|--|--|
| Current system language direction left-to-right | |
-| END alignment and MATCH_SYSTEM_LANGUAGE_DIRECTION set to TRUE. | END alignment and MATCH_SYSTEM_LANGUAGE_DIRECTION set to FALSE (default). |
-| ![ ](HelloWorld-System-END.png) | ![ ](HelloWorld-Default-END.png) |
+| MATCH_SYSTEM_LANGUAGE_DIRECTION set to TRUE. | MATCH_SYSTEM_LANGUAGE_DIRECTION set to FALSE (default). |
+| BEGIN alignment | BEGIN alignment |
+| ![ ](../assets/img/text-controls/HelloWorld-System-BEGIN.png) ![ ](HelloWorld-System-BEGIN.png) | ![ ](../assets/img/text-controls/HelloWorld-Default-BEGIN.png) ![ ](HelloWorld-Default-BEGIN.png) |
+| CENTER alignment | CENTER alignment |
+| ![ ](../assets/img/text-controls/HelloWorld-System-CENTER.png) ![ ](HelloWorld-System-CENTER.png) | ![ ](../assets/img/text-controls/HelloWorld-Default-CENTER.png) ![ ](HelloWorld-Default-CENTER.png) |
+| END alignment | END alignment |
+| ![ ](../assets/img/text-controls/HelloWorld-System-END.png) ![ ](HelloWorld-System-END.png) | ![ ](../assets/img/text-controls/HelloWorld-Default-END.png) ![ ](HelloWorld-Default-END.png) |
+
+
+| | |
+|--|--|
+| Current system language direction left-to-right | Current system language direction right-to-left |
+| ![ ](../assets/img/text-controls/LTR_order.png) ![ ](LTR_order.png) | ![ ](../assets/img/text-controls/RTL_order.png) ![ ](RTL_order.png) |
The examples above assume that the TextLabel size greater than the minimum required.