Fix for bidirectional support. 68/58668/3
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 25 Jan 2016 10:52:18 +0000 (10:52 +0000)
committerVíctor Cebollada <v.cebollada@samsung.com>
Wed, 3 Feb 2016 13:52:55 +0000 (05:52 -0800)
-Use the character's direction to know whether to mirror it.

This patches fix a 'mirroring' issue when there is bidirectional text.
i.e if RTL text is added to the string "(Hello world)", the text controller
replaces (mirror) the parenthesis getting the string ")Hello world( RTL_text"

It needs https://review.tizen.org/gerrit/#/c/58772/

Change-Id: Id7ed384560cbdee9e14f3e1ae2d29f029488f4b9
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
text/dali/devel-api/text-abstraction/bidirectional-support.cpp
text/dali/devel-api/text-abstraction/bidirectional-support.h
text/dali/internal/text-abstraction/bidirectional-support-impl.cpp
text/dali/internal/text-abstraction/bidirectional-support-impl.h
text/dali/internal/text-abstraction/font-client-plugin-impl.cpp

index 8182e9f..c706731 100644 (file)
@@ -69,9 +69,11 @@ void BidirectionalSupport::Reorder( BidiInfoIndex bidiInfoIndex,
 }
 
 bool BidirectionalSupport::GetMirroredText( Character* text,
+                                            CharacterDirection* directions,
                                             Length numberOfCharacters )
 {
   return GetImplementation( *this ).GetMirroredText( text,
+                                                     directions,
                                                      numberOfCharacters );
 }
 
index 255a94a..5ebeafd 100644 (file)
@@ -110,11 +110,13 @@ public:
    * @brief Replaces any character which could be mirrored.
    *
    * @param[in,out] text The text.
+   * @param[in] directions The direction of each paragraph.
    * @param[in] numberOfCharacters The number of characters.
    *
    * @return @e true if a character has been replaced.
    */
   bool GetMirroredText( Character* text,
+                        CharacterDirection* directions,
                         Length numberOfCharacters );
 
   /**
index 607a970..3f7dc52 100644 (file)
@@ -240,6 +240,7 @@ struct BidirectionalSupport::Plugin
   }
 
   bool GetMirroredText( Character* text,
+                        CharacterDirection* directions,
                         Length numberOfCharacters ) const
   {
     bool updated = false;
@@ -251,7 +252,11 @@ struct BidirectionalSupport::Plugin
 
       // Retrieve the mirrored character.
       FriBidiChar mirroredCharacter = character;
-      const bool mirrored = fribidi_get_mirror_char( character, &mirroredCharacter );
+      bool mirrored = false;
+      if( *( directions + index ) )
+      {
+        mirrored = fribidi_get_mirror_char( character, &mirroredCharacter );
+      }
       updated = updated || mirrored;
 
       // Update the character inside the text.
@@ -401,11 +406,12 @@ void BidirectionalSupport::Reorder( BidiInfoIndex bidiInfoIndex,
 }
 
 bool BidirectionalSupport::GetMirroredText( Character* text,
+                                            CharacterDirection* directions,
                                             Length numberOfCharacters )
 {
   CreatePlugin();
 
-  return mPlugin->GetMirroredText( text, numberOfCharacters );
+  return mPlugin->GetMirroredText( text, directions, numberOfCharacters );
 }
 
 bool BidirectionalSupport::GetParagraphDirection( BidiInfoIndex bidiInfoIndex ) const
index cbbb05f..65b1711 100644 (file)
@@ -79,6 +79,7 @@ public:
    * @copydoc Dali::BidirectionalSupport::GetMirroredText()
    */
   bool GetMirroredText( Character* text,
+                        CharacterDirection* directions,
                         Length numberOfCharacters );
 
   /**
index 3653603..dd29289 100644 (file)
@@ -1125,10 +1125,10 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
     else
     {
       error = FT_Set_Char_Size( ftFace,
-                              0,
-                              pointSize,
-                              mDpiHorizontal,
-                              mDpiVertical );
+                                0,
+                                pointSize,
+                                mDpiHorizontal,
+                                mDpiVertical );
 
       if( FT_Err_Ok == error )
       {