TextView - Support for emoticons. 46/19446/1
authorVictor Cebollada <v.cebollada@samsung.com>
Fri, 21 Mar 2014 16:02:16 +0000 (16:02 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Fri, 11 Apr 2014 14:35:51 +0000 (15:35 +0100)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] N/A

Change-Id: I339ad79f8c8bb045ade3a7ce1eba982d130cebbc
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/controls/text-view/relayout-utilities.cpp
dali-toolkit/internal/controls/text-view/relayout-utilities.h
dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp
dali-toolkit/internal/controls/text-view/text-view-impl.cpp
dali-toolkit/internal/controls/text-view/text-view-impl.h
dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp
dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h
dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp
dali-toolkit/internal/controls/text-view/text-view-processor-types.h
dali-toolkit/internal/controls/text-view/text-view-processor.cpp
dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp

index 93aa94e..567a56e 100644 (file)
 //
 
 // FILE HEADER
 //
 
 // FILE HEADER
-
 #include "relayout-utilities.h"
 
 // EXTERNAL INCLUDES
 #include <cmath>
 
 // INTERNAL INCLUDES
 #include "relayout-utilities.h"
 
 // EXTERNAL INCLUDES
 #include <cmath>
 
 // INTERNAL INCLUDES
+#include <dali/dali.h>
 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
 #include "text-view-line-processor.h"
 #include "text-view-word-processor.h"
 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
 #include "text-view-line-processor.h"
 #include "text-view-word-processor.h"
@@ -447,7 +447,7 @@ float CalculateJustificationOffset( const Toolkit::TextView::LineJustification j
   return offset;
 }
 
   return offset;
 }
 
-bool IsVisible( const Vector3& position, const Size& size, const Size& parentSize, VisibilityTestType type )
+bool IsVisible( const Vector3& position, const Size& size, const Size& parentSize, const VisibilityTestType type )
 {
   bool visible = false;
 
 {
   bool visible = false;
 
@@ -1045,6 +1045,8 @@ void CreateEllipsizeTextActor( const EllipsizeParameters& ellipsizeParameters,
   TextStyle ellipsizeStyle;
   // Stores the current size.
   Size ellipsizeSize;
   TextStyle ellipsizeStyle;
   // Stores the current size.
   Size ellipsizeSize;
+  //Whether current glyph is an emoticon.
+  bool isColorGlyph = false;
 
   float bearingOffset = 0.f;
 
 
   float bearingOffset = 0.f;
 
@@ -1056,27 +1058,30 @@ void CreateEllipsizeTextActor( const EllipsizeParameters& ellipsizeParameters,
   {
     const TextViewProcessor::CharacterLayoutInfo& ellipsizeCharacterLayoutInfo( *ellipsizeCharacterLayoutIt );
 
   {
     const TextViewProcessor::CharacterLayoutInfo& ellipsizeCharacterLayoutInfo( *ellipsizeCharacterLayoutIt );
 
-    if( ellipsizeStyle != ellipsizeCharacterLayoutInfo.mStyledText.mStyle )
+    if( isColorGlyph ||
+        ( isColorGlyph != ellipsizeCharacterLayoutInfo.mIsColorGlyph ) ||
+        ( ellipsizeStyle != ellipsizeCharacterLayoutInfo.mStyledText.mStyle ) )
     {
       // The style is different, so a new text-actor is needed.
       if( !ellipsizeText.IsEmpty() )
       {
         // It only creates a text-actor if there is any text.
     {
       // The style is different, so a new text-actor is needed.
       if( !ellipsizeText.IsEmpty() )
       {
         // It only creates a text-actor if there is any text.
-        TextActor ellipsizeTextActor = CreateTextActor( ellipsizeText, ellipsizeStyle, relayoutData.mTextActorCache );
-        ellipsizeTextActor.SetSize( ellipsizeSize );
-        ellipsizeTextActor.SetPosition( Vector3( ellipsizePosition.x, ellipsizePosition.y - bearingOffset, ellipsizePosition.z ) );
+        RenderableActor ellipsizeGlyphActor = CreateGlyphActor( ellipsizeText, ellipsizeStyle, relayoutData.mTextActorCache );
+        ellipsizeGlyphActor.SetSize( ellipsizeSize );
+        ellipsizeGlyphActor.SetPosition( Vector3( ellipsizePosition.x, ellipsizePosition.y - bearingOffset, ellipsizePosition.z ) );
 
         // Updates the position for the next text-actor.
         ellipsizePosition.x += ellipsizeSize.width;
 
         // Adds the text-actor to the list.
 
         // Updates the position for the next text-actor.
         ellipsizePosition.x += ellipsizeSize.width;
 
         // Adds the text-actor to the list.
-        relayoutData.mEllipsizedTextActors.push_back( ellipsizeTextActor );
+        relayoutData.mEllipsizedGlyphActors.push_back( ellipsizeGlyphActor );
       }
 
       // Resets the current ellipsize info.
       ellipsizeText = ellipsizeCharacterLayoutInfo.mStyledText.mText;
       ellipsizeStyle = ellipsizeCharacterLayoutInfo.mStyledText.mStyle;
       ellipsizeSize = ellipsizeCharacterLayoutInfo.mSize;
       }
 
       // Resets the current ellipsize info.
       ellipsizeText = ellipsizeCharacterLayoutInfo.mStyledText.mText;
       ellipsizeStyle = ellipsizeCharacterLayoutInfo.mStyledText.mStyle;
       ellipsizeSize = ellipsizeCharacterLayoutInfo.mSize;
+      isColorGlyph = ellipsizeCharacterLayoutInfo.mIsColorGlyph;
 
       bearingOffset = ( ellipsizeParameters.mLineDescender - ( ellipsizeCharacterLayoutInfo.mSize.height - ellipsizeCharacterLayoutInfo.mAscender ) ) * relayoutData.mShrinkFactor;
     }
 
       bearingOffset = ( ellipsizeParameters.mLineDescender - ( ellipsizeCharacterLayoutInfo.mSize.height - ellipsizeCharacterLayoutInfo.mAscender ) ) * relayoutData.mShrinkFactor;
     }
@@ -1091,13 +1096,13 @@ void CreateEllipsizeTextActor( const EllipsizeParameters& ellipsizeParameters,
 
   if( !ellipsizeText.IsEmpty() )
   {
 
   if( !ellipsizeText.IsEmpty() )
   {
-    // Creates the last text-actor.
-    TextActor ellipsizeTextActor = CreateTextActor( ellipsizeText, ellipsizeStyle, relayoutData.mTextActorCache );
-    ellipsizeTextActor.SetSize( ellipsizeSize );
-    ellipsizeTextActor.SetPosition( Vector3( ellipsizePosition.x, ellipsizePosition.y - bearingOffset, ellipsizePosition.z ) );
+    // Creates the last glyph-actor.
+    RenderableActor ellipsizeGlyphActor = CreateGlyphActor( ellipsizeText, ellipsizeStyle, relayoutData.mTextActorCache );
+    ellipsizeGlyphActor.SetSize( ellipsizeSize );
+    ellipsizeGlyphActor.SetPosition( Vector3( ellipsizePosition.x, ellipsizePosition.y - bearingOffset, ellipsizePosition.z ) );
 
 
-    // Adds the text-actor to the list.
-    relayoutData.mEllipsizedTextActors.push_back( ellipsizeTextActor );
+    // Adds the glyph-actor to the list.
+    relayoutData.mEllipsizedGlyphActors.push_back( ellipsizeGlyphActor );
   }
 }
 
   }
 }
 
@@ -1546,48 +1551,75 @@ void UpdateTextActorInfo( const TextView::VisualParameters& visualParameters,
         {
           TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
 
         {
           TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
 
-          if( characterLayoutInfo.mTextActor )
+          if( characterLayoutInfo.mIsColorGlyph )
           {
           {
-              // There is a new text-actor. Set text and everything to the previous one.
-            if( currentTextActorInfo.textActor )
-            {
-              currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
-              currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
-              currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
-
-              SetVisualParameters( currentTextActorInfo,
-                                   visualParameters,
-                                   relayoutData,
-                                   lineLayoutInfo.mSize.height );
-            }
+            ImageActor imageActor = ImageActor::DownCast( characterLayoutInfo.mGlyphActor );
 
 
-            currentTextActorInfo.text = characterLayoutInfo.mStyledText.mText;
-            currentTextActorInfo.position = Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
-                                                     characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
-                                                     characterLayoutInfo.mPosition.z );
-            currentTextActorInfo.size = characterLayoutInfo.mSize * relayoutData.mShrinkFactor;
+            if( characterLayoutInfo.mSetText )
+            {
+              GlyphImage image = GlyphImage::New( characterLayoutInfo.mStyledText.mText[0] );
 
 
-            currentTextActorInfo.color = characterLayoutInfo.mStyledText.mStyle.GetTextColor();
-            currentTextActorInfo.color.a = characterLayoutInfo.mColorAlpha;
+              if( image )
+              {
+                imageActor.SetImage( image );
+              }
+              characterLayoutInfo.mSetText = false;
+            }
 
 
-            currentTextActorInfo.gradientColor = characterLayoutInfo.mGradientColor;
-            currentTextActorInfo.startPoint = characterLayoutInfo.mStartPoint;
-            currentTextActorInfo.endPoint = characterLayoutInfo.mEndPoint;
+            imageActor.SetPosition( Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
+                                             characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
+                                             characterLayoutInfo.mPosition.z ) );
+            imageActor.SetSize( characterLayoutInfo.mSize );
 
 
-            // Update the current text-actor.
-            currentTextActorInfo.textActor = characterLayoutInfo.mTextActor;
+            // Sets the sort modifier value.
+            imageActor.SetSortModifier( visualParameters.mSortModifier );
           }
           else
           {
           }
           else
           {
-            // If this character layout has no text-actor is because this character has the same style than previous one.
-            // Add the character to the current text-actor and update the size.
-            if( characterLayoutInfo.mIsVisible && ( TextViewProcessor::LineSeparator != wordLayoutInfo.mType ) )
+            TextActor textActor = TextActor::DownCast( characterLayoutInfo.mGlyphActor );
+            if( textActor )
+            {
+              // There is a new text-actor. Set text and everything to the previous one.
+              if( currentTextActorInfo.textActor )
+              {
+                currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
+                currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
+                currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
+
+                SetVisualParameters( currentTextActorInfo,
+                                     visualParameters,
+                                     relayoutData,
+                                     lineLayoutInfo.mSize.height );
+              }
+
+              currentTextActorInfo.text = characterLayoutInfo.mStyledText.mText;
+              currentTextActorInfo.position = Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
+                                                       characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
+                                                       characterLayoutInfo.mPosition.z );
+              currentTextActorInfo.size = characterLayoutInfo.mSize * relayoutData.mShrinkFactor;
+
+              currentTextActorInfo.color = characterLayoutInfo.mStyledText.mStyle.GetTextColor();
+              currentTextActorInfo.color.a = characterLayoutInfo.mColorAlpha;
+
+              currentTextActorInfo.gradientColor = characterLayoutInfo.mGradientColor;
+              currentTextActorInfo.startPoint = characterLayoutInfo.mStartPoint;
+              currentTextActorInfo.endPoint = characterLayoutInfo.mEndPoint;
+
+              // Update the current text-actor.
+              currentTextActorInfo.textActor = textActor;
+            }
+            else
             {
             {
-              currentTextActorInfo.text.Append( characterLayoutInfo.mStyledText.mText );
+              // If this character layout has no text-actor is because this character has the same style than previous one.
+              // Add the character to the current text-actor and update the size.
+              if( characterLayoutInfo.mIsVisible && ( TextViewProcessor::LineSeparator != wordLayoutInfo.mType ) )
+              {
+                currentTextActorInfo.text.Append( characterLayoutInfo.mStyledText.mText );
 
 
-              currentTextActorInfo.position.y = std::min( currentTextActorInfo.position.y, ( characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y ) );
-              currentTextActorInfo.size.width += characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor;
-              currentTextActorInfo.size.height = std::max( currentTextActorInfo.size.height, characterLayoutInfo.mSize.height * relayoutData.mShrinkFactor );
+                currentTextActorInfo.position.y = std::min( currentTextActorInfo.position.y, ( characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y ) );
+                currentTextActorInfo.size.width += characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor;
+                currentTextActorInfo.size.height = std::max( currentTextActorInfo.size.height, characterLayoutInfo.mSize.height * relayoutData.mShrinkFactor );
+              }
             }
           }
         } // end characters
             }
           }
         } // end characters
@@ -1610,21 +1642,21 @@ void UpdateTextActorInfo( const TextView::VisualParameters& visualParameters,
     } //end groups of words
   } // end lines
 
     } //end groups of words
   } // end lines
 
-  for( std::vector<TextActor>::iterator it = relayoutData.mEllipsizedTextActors.begin(),
-         endIt = relayoutData.mEllipsizedTextActors.end();
+  for( std::vector<RenderableActor>::iterator it = relayoutData.mEllipsizedGlyphActors.begin(),
+         endIt = relayoutData.mEllipsizedGlyphActors.end();
        it != endIt;
        ++it )
   {
        it != endIt;
        ++it )
   {
-    TextActor textActor = ( *it );
+    RenderableActor glyphActor = ( *it );
 
 
-    textActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    textActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+    glyphActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+    glyphActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
 
     // Sets the sort modifier value.
 
     // Sets the sort modifier value.
-    textActor.SetSortModifier( visualParameters.mSortModifier );
+    glyphActor.SetSortModifier( visualParameters.mSortModifier );
 
     // Enables or disables the blending.
 
     // Enables or disables the blending.
-    textActor.SetBlendMode( !visualParameters.mSnapshotModeEnabled ? BlendingMode::ON : BlendingMode::OFF );
+    glyphActor.SetBlendMode( !visualParameters.mSnapshotModeEnabled ? BlendingMode::ON : BlendingMode::OFF );
   }
 }
 
   }
 }
 
@@ -1842,16 +1874,16 @@ void SetUnderlineInfo( TextView::RelayoutData& relayoutData )
   } // end of lines.
 }
 
   } // end of lines.
 }
 
-void RemoveTextActors( Actor textView,
-                       const std::vector<TextActor>& textActors )
+void RemoveGlyphActors( Actor textView,
+                        const std::vector<RenderableActor>& glyphActors )
 {
 {
-  // Removes previously inserted text-actors.
+  // Removes previously inserted renderable-actors.
   // The SplitByNewLineChar::Relayout(), SplitByWord::Relayout() and SplitByChar::Relayout() functions add
   // The SplitByNewLineChar::Relayout(), SplitByWord::Relayout() and SplitByChar::Relayout() functions add
-  // text-actors to the text-view. A handle to these text-actors are stored and passed to this function
-  // in order to remove 'only' text-actors added by these functions.
+  // renderable-actors to the text-view. A handle to these renderable-actors are stored and passed to this function
+  // in order to remove 'only' renderable-actors added by these functions.
   // Any other actor added by a programmer or application won't be removed.
 
   // Any other actor added by a programmer or application won't be removed.
 
-  for( std::vector<TextActor>::const_reverse_iterator it = textActors.rbegin(), endIt = textActors.rend(); it != endIt; ++it )
+  for( std::vector<RenderableActor>::const_reverse_iterator it = glyphActors.rbegin(), endIt = glyphActors.rend(); it != endIt; ++it )
   {
     textView.Remove( *it );
   }
   {
     textView.Remove( *it );
   }
@@ -1894,16 +1926,16 @@ void InsertToTextView( const TextView::RelayoutOperationMask relayoutOperationMa
         {
           TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
 
         {
           TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
 
-          if( characterLayoutInfo.mIsVisible && characterLayoutInfo.mTextActor ) // White spaces and '\n' characters doesn't have a text-actor.
+          if( characterLayoutInfo.mIsVisible && characterLayoutInfo.mGlyphActor ) // White spaces and '\n' characters doesn't have a text-actor.
           {
             //Add to the text-view.
             if( insertToTextView )
             {
           {
             //Add to the text-view.
             if( insertToTextView )
             {
-              textView.Add( characterLayoutInfo.mTextActor );
+              textView.Add( characterLayoutInfo.mGlyphActor );
             }
             if( insertToTextActorList )
             {
             }
             if( insertToTextActorList )
             {
-              relayoutData.mTextActors.push_back( characterLayoutInfo.mTextActor );
+              relayoutData.mGlyphActors.push_back( characterLayoutInfo.mGlyphActor );
             }
           }
         } // end group of character
             }
           }
         } // end group of character
@@ -1911,27 +1943,27 @@ void InsertToTextView( const TextView::RelayoutOperationMask relayoutOperationMa
     } // end group of words
   } // end lines
 
     } // end group of words
   } // end lines
 
-  for( std::vector<TextActor>::iterator it = relayoutData.mEllipsizedTextActors.begin(),
-         endIt = relayoutData.mEllipsizedTextActors.end();
+  for( std::vector<RenderableActor>::iterator it = relayoutData.mEllipsizedGlyphActors.begin(),
+         endIt = relayoutData.mEllipsizedGlyphActors.end();
        it != endIt;
        ++it )
   {
        it != endIt;
        ++it )
   {
-    TextActor textActor = ( *it );
+    RenderableActor glyphActor = ( *it );
 
     //Add to the text-view.
     if( insertToTextView )
     {
 
     //Add to the text-view.
     if( insertToTextView )
     {
-      textView.Add( textActor );
+      textView.Add( glyphActor );
     }
     if( insertToTextActorList )
     {
     }
     if( insertToTextActorList )
     {
-      relayoutData.mTextActors.push_back( textActor );
+      relayoutData.mGlyphActors.push_back( glyphActor );
     }
   }
     }
   }
-  relayoutData.mEllipsizedTextActors.clear();
+  relayoutData.mEllipsizedGlyphActors.clear();
 }
 
 }
 
-TextActor CreateTextActor( const Text& text, const TextStyle& style, TextActorCache& cache )
+RenderableActor CreateGlyphActor( const Text& text, const TextStyle& style, TextActorCache& cache )
 {
   TextActor textActor = cache.RetrieveTextActor();
 
 {
   TextActor textActor = cache.RetrieveTextActor();
 
index ee0cc96..afd116f 100644 (file)
@@ -462,13 +462,13 @@ void CalculateUnderlineInfo( TextView::RelayoutData& relayoutData );
 void SetUnderlineInfo( TextView::RelayoutData& relayoutData );
 
 /**
 void SetUnderlineInfo( TextView::RelayoutData& relayoutData );
 
 /**
- * Remove text-actor from the text-view.
+ * Remove renderable-actor from the text-view.
  *
  * @param[in,out] textView The text-view.
  *
  * @param[in,out] textView The text-view.
- * @param[in] textActors text-actors to be removed from the text-view.
+ * @param[in] glyphActors renderable-actors to be removed from the text-view.
  */
  */
-void RemoveTextActors( Actor textView,
-                       const std::vector<TextActor>& textActors );
+void RemoveGlyphActors( Actor textView,
+                        const std::vector<RenderableActor>& glyphActors );
 
 /**
  * Inserts the text-actors into the text-view and/or the text-actor's list.
 
 /**
  * Inserts the text-actors into the text-view and/or the text-actor's list.
@@ -482,13 +482,15 @@ void InsertToTextView( TextView::RelayoutOperationMask relayoutOperationMask,
                        TextView::RelayoutData& relayoutData );
 
 /**
                        TextView::RelayoutData& relayoutData );
 
 /**
- * Retrieves a new text-actor from the cache of text-actors or creating a new one if it's empty.
+ * Retrieves a new glyph-actor from the cache of text-actors or creating a new one if it's empty.
  *
  * @param[in] text The text-actor's text.
  * @param[in] style The text-actor's style.
  * @param[in] cache The cache of text-actors.
  *
  * @param[in] text The text-actor's text.
  * @param[in] style The text-actor's style.
  * @param[in] cache The cache of text-actors.
+ *
+ * @return a RenderableActor with the text's glyph.
  */
  */
-TextActor CreateTextActor( const Text& text, const TextStyle& style, TextActorCache& cache );
+RenderableActor CreateGlyphActor( const Text& text, const TextStyle& style, TextActorCache& cache );
 
 } // namespace TextViewRelayout
 
 
 } // namespace TextViewRelayout
 
index 36df1e6..9cc8870 100644 (file)
@@ -43,7 +43,7 @@ CharacterLayoutInfo::CharacterLayoutInfo()
   mAscender( 0.f ),
   mUnderlineThickness( 0.f ),
   mUnderlinePosition( 0.f ),
   mAscender( 0.f ),
   mUnderlineThickness( 0.f ),
   mUnderlinePosition( 0.f ),
-  mTextActor(),
+  mGlyphActor(),
   mStyledText(),
   mColorAlpha( 1.f ),
   mGradientColor(),
   mStyledText(),
   mColorAlpha( 1.f ),
   mGradientColor(),
@@ -51,7 +51,8 @@ CharacterLayoutInfo::CharacterLayoutInfo()
   mEndPoint(),
   mIsVisible( true ),
   mSetText( true ),
   mEndPoint(),
   mIsVisible( true ),
   mSetText( true ),
-  mSetStyle( true )
+  mSetStyle( true ),
+  mIsColorGlyph( false )
 {
 }
 
 {
 }
 
@@ -65,7 +66,7 @@ CharacterLayoutInfo::CharacterLayoutInfo( const CharacterLayoutInfo& character )
   mAscender( character.mAscender ),
   mUnderlineThickness( character.mUnderlineThickness ),
   mUnderlinePosition( character.mUnderlinePosition ),
   mAscender( character.mAscender ),
   mUnderlineThickness( character.mUnderlineThickness ),
   mUnderlinePosition( character.mUnderlinePosition ),
-  mTextActor( character.mTextActor ),
+  mGlyphActor( character.mGlyphActor ),
   mStyledText( character.mStyledText ),
   mColorAlpha( character.mColorAlpha ),
   mGradientColor( character.mGradientColor ),
   mStyledText( character.mStyledText ),
   mColorAlpha( character.mColorAlpha ),
   mGradientColor( character.mGradientColor ),
@@ -73,7 +74,8 @@ CharacterLayoutInfo::CharacterLayoutInfo( const CharacterLayoutInfo& character )
   mEndPoint( character.mEndPoint ),
   mIsVisible( character.mIsVisible ),
   mSetText( character.mSetText ),
   mEndPoint( character.mEndPoint ),
   mIsVisible( character.mIsVisible ),
   mSetText( character.mSetText ),
-  mSetStyle( character.mSetStyle )
+  mSetStyle( character.mSetStyle ),
+  mIsColorGlyph( character.mIsColorGlyph )
 {
 }
 
 {
 }
 
@@ -98,8 +100,9 @@ CharacterLayoutInfo& CharacterLayoutInfo::operator=( const CharacterLayoutInfo&
   mIsVisible = character.mIsVisible;
   mSetText = character.mSetText;
   mSetStyle = character.mSetStyle;
   mIsVisible = character.mIsVisible;
   mSetText = character.mSetText;
   mSetStyle = character.mSetStyle;
+  mIsColorGlyph = character.mIsColorGlyph;
 
 
-  mTextActor = character.mTextActor;
+  mGlyphActor = character.mGlyphActor;
 
   return *this;
 }
 
   return *this;
 }
index 4488b2f..deda3d1 100644 (file)
@@ -591,8 +591,8 @@ void TextView::GetTextLayoutInfo()
     if( ( textViewSize.width > Math::MACHINE_EPSILON_1000 ) &&
         ( textViewSize.height > Math::MACHINE_EPSILON_1000 ) )
     {
     if( ( textViewSize.width > Math::MACHINE_EPSILON_1000 ) &&
         ( textViewSize.height > Math::MACHINE_EPSILON_1000 ) )
     {
-      // Check if the text-view has text-actors.
-      const bool hasTextActors = !mRelayoutData.mTextActors.empty();
+      // Check if the text-view has glyph-actors.
+      const bool hasGlyphActors = !mRelayoutData.mGlyphActors.empty();
 
       RelayoutOperationMask mask = NO_RELAYOUT;
       if( relayoutSizeAndPositionNeeded )
 
       RelayoutOperationMask mask = NO_RELAYOUT;
       if( relayoutSizeAndPositionNeeded )
@@ -608,18 +608,18 @@ void TextView::GetTextLayoutInfo()
         mask = static_cast<RelayoutOperationMask>( mask | RELAYOUT_VISIBILITY );
       }
 
         mask = static_cast<RelayoutOperationMask>( mask | RELAYOUT_VISIBILITY );
       }
 
-      if( hasTextActors )
+      if( hasGlyphActors )
       {
       {
-        // Remove text-actors from the text-view as some text-operation like CreateTextInfo()
+        // Remove glyph-actors from the text-view as some text-operation like CreateTextInfo()
         // add them to the text-actor cache.
         // add them to the text-actor cache.
-        TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
-        mRelayoutData.mTextActors.clear();
+        TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+        mRelayoutData.mGlyphActors.clear();
       }
 
       }
 
-      // Relays-out but doesn't add text-actors to the text-view.
+      // Relays-out but doesn't add glyph-actors to the text-view.
       DoRelayOut( textViewSize.GetVectorXY(), mask );
 
       DoRelayOut( textViewSize.GetVectorXY(), mask );
 
-      if( hasTextActors )
+      if( hasGlyphActors )
       {
         mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
         mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
       {
         mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
         mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
@@ -648,7 +648,7 @@ void TextView::SetSortModifier( float depthOffset )
 {
   mVisualParameters.mSortModifier = depthOffset;
 
 {
   mVisualParameters.mSortModifier = depthOffset;
 
-  for( std::vector<TextActor>::iterator it = mRelayoutData.mTextActors.begin(), endIt = mRelayoutData.mTextActors.end();
+  for( std::vector<RenderableActor>::iterator it = mRelayoutData.mGlyphActors.begin(), endIt = mRelayoutData.mGlyphActors.end();
        it != endIt;
        ++it )
   {
        it != endIt;
        ++it )
   {
@@ -665,10 +665,10 @@ void TextView::SetSnapshotModeEnabled( bool enable )
 {
   if( enable != mVisualParameters.mSnapshotModeEnabled )
   {
 {
   if( enable != mVisualParameters.mSnapshotModeEnabled )
   {
-    // Remove first all text-actors
-    if( !mRelayoutData.mTextActors.empty() )
+    // Remove first all glyph-actors
+    if( !mRelayoutData.mGlyphActors.empty() )
     {
     {
-      TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
+      TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
     }
 
     mVisualParameters.mSnapshotModeEnabled = enable;
     }
 
     mVisualParameters.mSnapshotModeEnabled = enable;
@@ -945,7 +945,7 @@ TextView::RelayoutData::RelayoutData()
   mTextLayoutInfo(),
   mCharacterLogicalToVisualMap(),
   mCharacterVisualToLogicalMap(),
   mTextLayoutInfo(),
   mCharacterLogicalToVisualMap(),
   mCharacterVisualToLogicalMap(),
-  mTextActors(),
+  mGlyphActors(),
   mCharacterLayoutInfoTable(),
   mLines(),
   mTextSizeForRelayoutOption()
   mCharacterLayoutInfoTable(),
   mLines(),
   mTextSizeForRelayoutOption()
@@ -958,7 +958,7 @@ TextView::RelayoutData::RelayoutData( const TextView::RelayoutData& relayoutData
   mTextLayoutInfo( relayoutData.mTextLayoutInfo ),
   mCharacterLogicalToVisualMap( relayoutData.mCharacterLogicalToVisualMap ),
   mCharacterVisualToLogicalMap( relayoutData.mCharacterVisualToLogicalMap ),
   mTextLayoutInfo( relayoutData.mTextLayoutInfo ),
   mCharacterLogicalToVisualMap( relayoutData.mCharacterLogicalToVisualMap ),
   mCharacterVisualToLogicalMap( relayoutData.mCharacterVisualToLogicalMap ),
-  mTextActors( relayoutData.mTextActors ),
+  mGlyphActors( relayoutData.mGlyphActors ),
   mCharacterLayoutInfoTable( relayoutData.mCharacterLayoutInfoTable ),
   mLines( relayoutData.mLines ),
   mTextSizeForRelayoutOption( relayoutData.mTextSizeForRelayoutOption )
   mCharacterLayoutInfoTable( relayoutData.mCharacterLayoutInfoTable ),
   mLines( relayoutData.mLines ),
   mTextSizeForRelayoutOption( relayoutData.mTextSizeForRelayoutOption )
@@ -972,7 +972,7 @@ TextView::RelayoutData& TextView::RelayoutData::operator=( const TextView::Relay
   mTextLayoutInfo = relayoutData.mTextLayoutInfo;
   mCharacterLogicalToVisualMap = relayoutData.mCharacterLogicalToVisualMap;
   mCharacterVisualToLogicalMap = relayoutData.mCharacterVisualToLogicalMap;
   mTextLayoutInfo = relayoutData.mTextLayoutInfo;
   mCharacterLogicalToVisualMap = relayoutData.mCharacterLogicalToVisualMap;
   mCharacterVisualToLogicalMap = relayoutData.mCharacterVisualToLogicalMap;
-  mTextActors = relayoutData.mTextActors;
+  mGlyphActors = relayoutData.mGlyphActors;
   mCharacterLayoutInfoTable = relayoutData.mCharacterLayoutInfoTable;
   mLines = relayoutData.mLines;
   mTextSizeForRelayoutOption = relayoutData.mTextSizeForRelayoutOption;
   mCharacterLayoutInfoTable = relayoutData.mCharacterLayoutInfoTable;
   mLines = relayoutData.mLines;
   mTextSizeForRelayoutOption = relayoutData.mTextSizeForRelayoutOption;
@@ -1026,12 +1026,12 @@ Vector3 TextView::GetNaturalSize()
   {
     // There are SetText, Inserts or Removes to do. It means the current layout info is not updated.
 
   {
     // There are SetText, Inserts or Removes to do. It means the current layout info is not updated.
 
-    if( !mRelayoutData.mTextActors.empty() )
+    if( !mRelayoutData.mGlyphActors.empty() )
     {
     {
-      // Remove text-actors from the text-view as some text-operation like CreateTextInfo()
+      // Remove glyph-actors from the text-view as some text-operation like CreateTextInfo()
       // add them to the text-actor cache.
       // add them to the text-actor cache.
-      TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
-      mRelayoutData.mTextActors.clear();
+      TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+      mRelayoutData.mGlyphActors.clear();
 
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
 
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
@@ -1060,26 +1060,26 @@ float TextView::GetHeightForWidth( float width )
     // Check if the given width is different than the current one.
     const bool differentWidth = ( fabsf( width - mRelayoutData.mTextViewSize.width ) > Math::MACHINE_EPSILON_1000 );
 
     // Check if the given width is different than the current one.
     const bool differentWidth = ( fabsf( width - mRelayoutData.mTextViewSize.width ) > Math::MACHINE_EPSILON_1000 );
 
-    // Check if the text-view has text-actors.
-    const bool hasTextActors = !mRelayoutData.mTextActors.empty();
+    // Check if the text-view has glyph-actors.
+    const bool hasGlyphActors = !mRelayoutData.mGlyphActors.empty();
 
     // Check which layout operations need to be done.
     const bool relayoutSizeAndPositionNeeded = ( mRelayoutOperations & RELAYOUT_SIZE_POSITION ) || differentWidth;
 
     if( relayoutSizeAndPositionNeeded )
     {
 
     // Check which layout operations need to be done.
     const bool relayoutSizeAndPositionNeeded = ( mRelayoutOperations & RELAYOUT_SIZE_POSITION ) || differentWidth;
 
     if( relayoutSizeAndPositionNeeded )
     {
-      if( hasTextActors )
+      if( hasGlyphActors )
       {
       {
-        // Remove text-actors from the text-view as some text-operation like CreateTextInfo()
+        // Remove glyph-actors from the text-view as some text-operation like CreateTextInfo()
         // add them to the text-actor cache.
         // add them to the text-actor cache.
-        TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
-        mRelayoutData.mTextActors.clear();
+        TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+        mRelayoutData.mGlyphActors.clear();
       }
 
       // Use the given width.
       const Vector2 textViewSize( width, GetControlSize().height );
 
       }
 
       // Use the given width.
       const Vector2 textViewSize( width, GetControlSize().height );
 
-      // Relays-out but doesn't add text-actors to the text-view.
+      // Relays-out but doesn't add glyph-actors to the text-view.
       DoRelayOut( textViewSize, RELAYOUT_SIZE_POSITION );
     }
 
       DoRelayOut( textViewSize, RELAYOUT_SIZE_POSITION );
     }
 
@@ -1092,13 +1092,13 @@ float TextView::GetHeightForWidth( float width )
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_SIZE_POSITION );
     }
 
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_SIZE_POSITION );
     }
 
-    if( hasTextActors )
+    if( hasGlyphActors )
     {
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
     }
 
     {
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
     }
 
-    if( differentWidth || hasTextActors )
+    if( differentWidth || hasGlyphActors )
     {
       RelayoutRequest();
     }
     {
       RelayoutRequest();
     }
@@ -1216,7 +1216,7 @@ void TextView::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
 
   if( size != mRelayoutData.mTextViewSize )
   {
 
   if( size != mRelayoutData.mTextViewSize )
   {
-    // if new size is different than the prevoius one, set positions and maybe sizes of all text-actor is needed.
+    // if new size is different than the prevoius one, set positions and maybe sizes of all glyph-actor is needed.
     if( RELAYOUT_ALL != mRelayoutOperations )
     {
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations |
     if( RELAYOUT_ALL != mRelayoutOperations )
     {
       mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations |
@@ -1230,16 +1230,16 @@ void TextView::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
     }
   }
 
     }
   }
 
-  // Remove text-actors from text-view
-  if( !mRelayoutData.mTextActors.empty() && ( mRelayoutOperations & RELAYOUT_REMOVE_TEXT_ACTORS ) )
+  // Remove glyph-actors from text-view
+  if( !mRelayoutData.mGlyphActors.empty() && ( mRelayoutOperations & RELAYOUT_REMOVE_TEXT_ACTORS ) )
   {
   {
-    TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
-    mRelayoutData.mTextActors.clear();
+    TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+    mRelayoutData.mGlyphActors.clear();
   }
 
   if( NO_RELAYOUT != mRelayoutOperations )
   {
   }
 
   if( NO_RELAYOUT != mRelayoutOperations )
   {
-    // Relays-out and add text-actors to the text-view.
+    // Relays-out and add glyph-actors to the text-view.
     DoRelayOut( size, mRelayoutOperations );
     ProcessSnapshot( size );
   }
     DoRelayOut( size, mRelayoutOperations );
     ProcessSnapshot( size );
   }
@@ -1373,7 +1373,7 @@ void TextView::OptimizeTextViewProcessorOperations()
 
 void TextView::DoRelayOut( const Size& textViewSize, const RelayoutOperationMask relayoutOperationMask )
 {
 
 void TextView::DoRelayOut( const Size& textViewSize, const RelayoutOperationMask relayoutOperationMask )
 {
-  // Traverse the relayout operation vector. It fills the natural size, layout and text-actor data structures.
+  // Traverse the relayout operation vector. It fills the natural size, layout and glyph-actor data structures.
   if( !mTextViewProcessorOperations.empty() )
   {
     PerformTextViewProcessorOperations();
   if( !mTextViewProcessorOperations.empty() )
   {
     PerformTextViewProcessorOperations();
@@ -1740,7 +1740,7 @@ void TextView::DoSetScrollPosition( const Vector2& position )
 
   if( mOffscreenRootActor )
   {
 
   if( mOffscreenRootActor )
   {
-    // If there is a render-task it needs to be refreshed. Therefore text-actors need to be
+    // If there is a render-task it needs to be refreshed. Therefore glyph-actors need to be
     // set to visible.
     mOffscreenRootActor.SetVisible( true );
   }
     // set to visible.
     mOffscreenRootActor.SetVisible( true );
   }
index 7e5c556..2d35bcc 100644 (file)
@@ -640,8 +640,8 @@ public:
     TextViewProcessor::TextLayoutInfo               mTextLayoutInfo;              ///< Stores metrics, layout info (size, direction, type of word) and text-actor info for the whole text.
     std::vector<int>                                mCharacterLogicalToVisualMap; ///< Reorder map that stores each character's visual (output) index according to its logical (input) index
     std::vector<int>                                mCharacterVisualToLogicalMap; ///< Reorder map that stores each character's logical (input) index according to its visual (output) index
     TextViewProcessor::TextLayoutInfo               mTextLayoutInfo;              ///< Stores metrics, layout info (size, direction, type of word) and text-actor info for the whole text.
     std::vector<int>                                mCharacterLogicalToVisualMap; ///< Reorder map that stores each character's visual (output) index according to its logical (input) index
     std::vector<int>                                mCharacterVisualToLogicalMap; ///< Reorder map that stores each character's logical (input) index according to its visual (output) index
-    std::vector<TextActor>                          mTextActors;                  ///< Stores handles of those text-actors which are currently added to the text-view.
-    std::vector<TextActor>                          mEllipsizedTextActors;        ///< Stores handles of those text-actors which are used to ellipsize the text.
+    std::vector<RenderableActor>                    mGlyphActors;                 ///< Stores handles of those text-actors which are currently added to the text-view.
+    std::vector<RenderableActor>                    mEllipsizedGlyphActors;       ///< Stores handles of those text-actors which are used to ellipsize the text.
     Toolkit::TextView::CharacterLayoutInfoContainer mCharacterLayoutInfoTable;    ///< Stores layout info per character sorted by the character's visual index.
     Toolkit::TextView::LineLayoutInfoContainer      mLines;                       ///< Stores an index to the first character of each line.
     Size                                            mTextSizeForRelayoutOption;   ///< Stores the text size after relayout.
     Toolkit::TextView::CharacterLayoutInfoContainer mCharacterLayoutInfoTable;    ///< Stores layout info per character sorted by the character's visual index.
     Toolkit::TextView::LineLayoutInfoContainer      mLines;                       ///< Stores an index to the first character of each line.
     Size                                            mTextSizeForRelayoutOption;   ///< Stores the text size after relayout.
index cda3846..7671c34 100644 (file)
@@ -29,6 +29,10 @@ namespace Internal
 namespace TextViewProcessor
 {
 
 namespace TextViewProcessor
 {
 
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gTextViewProcessorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_TEXT_VIEW_PROCESSOR");
+#endif
+
 void dbgPrint( const WordLayoutInfo& word )
 {
   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
 void dbgPrint( const WordLayoutInfo& word )
 {
   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
@@ -40,9 +44,14 @@ void dbgPrint( const WordLayoutInfo& word )
     std::cout << "[" << character.mSize << std::endl;
     std::cout << " ascender " << character.mAscender << std::endl;
 
     std::cout << "[" << character.mSize << std::endl;
     std::cout << " ascender " << character.mAscender << std::endl;
 
-    if( character.mTextActor )
+    TextActor textActor = TextActor::DownCast( character.mGlyphActor );
+    if( textActor )
+    {
+      std::cout << "[" << textActor.GetText() << "]";
+    }
+    else
     {
     {
-      std::cout << "[" << character.mTextActor.GetText() << "]";
+      std::cout << "[ImageActor]" << std::endl;
     }
     std::cout << "{" << character.mStyledText.mText.GetText() << "}";
   }
     }
     std::cout << "{" << character.mStyledText.mText.GetText() << "}";
   }
index dc1e210..56a3907 100644 (file)
@@ -19,6 +19,7 @@
 
 // INTERNAL INCLUDES
 #include "text-view-processor-types.h"
 
 // INTERNAL INCLUDES
 #include "text-view-processor-types.h"
+#include <dali/integration-api/debug.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -32,6 +33,10 @@ namespace Internal
 namespace TextViewProcessor
 {
 
 namespace TextViewProcessor
 {
 
+#if defined(DEBUG_ENABLED)
+extern Debug::Filter* gTextViewProcessorLogFilter;
+#endif
+
 void dbgPrint( const WordLayoutInfo& word );
 void dbgPrint( const WordGroupLayoutInfo& group );
 void dbgPrint( const LineLayoutInfo& line );
 void dbgPrint( const WordLayoutInfo& word );
 void dbgPrint( const WordGroupLayoutInfo& group );
 void dbgPrint( const LineLayoutInfo& line );
index f09955d..63360b7 100644 (file)
@@ -16,6 +16,7 @@
 
 // INTERNAL INCLUDES
 #include "text-view-processor-helper-functions.h"
 
 // INTERNAL INCLUDES
 #include "text-view-processor-helper-functions.h"
+#include "text-view-processor-dbg.h"
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -56,6 +57,9 @@ TextSeparatorType GetTextSeparatorType( const Character& character )
 
 void ChooseFontFamilyName( MarkupProcessor::StyledText& text )
 {
 
 void ChooseFontFamilyName( MarkupProcessor::StyledText& text )
 {
+  DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "-->TextViewProcessor::ChooseFontFamilyName\n" );
+  DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "   input font name: [%s]\n", text.mStyle.GetFontName().c_str() );
+
   bool userDefinedFontFamilyName = false;
 
   // First check if there is a font defined in the style and it supports the given text.
   bool userDefinedFontFamilyName = false;
 
   // First check if there is a font defined in the style and it supports the given text.
@@ -88,6 +92,8 @@ void ChooseFontFamilyName( MarkupProcessor::StyledText& text )
       text.mStyle.SetFontName( "" );
     }
   }
       text.mStyle.SetFontName( "" );
     }
   }
+  DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "  output font name: [%s]\n", text.mStyle.GetFontName().c_str() );
+  DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "<--TextViewProcessor::ChooseFontFamilyName\n" );
 }
 
 void GetIndicesFromGlobalCharacterIndex( const std::size_t index,
 }
 
 void GetIndicesFromGlobalCharacterIndex( const std::size_t index,
index 8c9d60a..0498cc0 100644 (file)
@@ -130,16 +130,17 @@ struct CharacterLayoutInfo
   float       mUnderlineThickness; ///< The underline's thickness.
   float       mUnderlinePosition;  ///< The underline's position.
 
   float       mUnderlineThickness; ///< The underline's thickness.
   float       mUnderlinePosition;  ///< The underline's position.
 
-  TextActor                   mTextActor;     ///< Handle to a text-actor.
-  MarkupProcessor::StyledText mStyledText;    ///< Stores the text and its style.
-  float                       mColorAlpha;    ///< Alpha component for the initial text color when text is faded.
-  Vector4                     mGradientColor; ///< Gradient color.
-  Vector2                     mStartPoint;    ///< Gradient start point.
-  Vector2                     mEndPoint;      ///< Gradient end point.
-
-  bool                        mIsVisible:1;   ///< Whether the text-actor is visible.
-  bool                        mSetText:1;     ///< Whether a new text needs to be set in the text-actor.
-  bool                        mSetStyle:1;    ///< Whether a new style needs to be set in the text-actor.
+  RenderableActor             mGlyphActor;     ///< Handle to a text-actor.
+  MarkupProcessor::StyledText mStyledText;     ///< Stores the text and its style.
+  float                       mColorAlpha;     ///< Alpha component for the initial text color when text is faded.
+  Vector4                     mGradientColor;  ///< Gradient color.
+  Vector2                     mStartPoint;     ///< Gradient start point.
+  Vector2                     mEndPoint;       ///< Gradient end point.
+
+  bool                        mIsVisible:1;    ///< Whether the text-actor is visible.
+  bool                        mSetText:1;      ///< Whether a new text needs to be set in the text-actor.
+  bool                        mSetStyle:1;     ///< Whether a new style needs to be set in the text-actor.
+  bool                        mIsColorGlyph:1; ///< Whether this character is an emoticon.
 };
 typedef std::vector<CharacterLayoutInfo> CharacterLayoutInfoContainer;
 
 };
 typedef std::vector<CharacterLayoutInfo> CharacterLayoutInfoContainer;
 
index e25f783..482877a 100644 (file)
@@ -1067,17 +1067,18 @@ void InitializeTextActorInfo( TextView::RelayoutData& relayoutData )
     return;
   }
 
     return;
   }
 
-  std::size_t characterGlobalIndex = 0; // Index to the global character (within the whole text).
-  std::size_t lineLayoutInfoIndex = 0;  // Index to the laid out line info.
+  std::size_t characterGlobalIndex = 0;  // Index to the global character (within the whole text).
+  std::size_t lineLayoutInfoIndex = 0;   // Index to the laid out line info.
   const std::size_t lineLayoutInfoSize = relayoutData.mLines.size(); // Number or laid out lines.
   const std::size_t lineLayoutInfoSize = relayoutData.mLines.size(); // Number or laid out lines.
-  bool lineLayoutEnd = false;           // Whether lineLayoutInfoIndex points at the last laid out line.
-  bool textActorCreatedForLine = false;
+  bool lineLayoutEnd = false;            // Whether lineLayoutInfoIndex points at the last laid out line.
+  bool glyphActorCreatedForLine = false; // Whether a renderable actor has been created for this line.
 
 
-  TextActor currentTextActor;           // text-actor used when the edit mode is disabled.
-  TextStyle currentStyle;               // style for the current text-actor.
-  Vector4 currentGradientColor;         // gradient color for the current text-actor.
-  Vector2 currentStartPoint;            // start point for the current text-actor.
-  Vector2 currentEndPoint;              // end point for the current text-actor.
+  RenderableActor currentGlyphActor;      // text-actor used when the edit mode is disabled.
+  TextStyle currentStyle;                // style for the current text-actor.
+  Vector4 currentGradientColor;          // gradient color for the current text-actor.
+  Vector2 currentStartPoint;             // start point for the current text-actor.
+  Vector2 currentEndPoint;               // end point for the current text-actor.
+  bool currentIsColorGlyph = false;      // Whether current glyph is an emoticon.
 
   std::vector<TextActor> textActorsToRemove; // Keep a vector of text-actors to be included into the cache.
 
 
   std::vector<TextActor> textActorsToRemove; // Keep a vector of text-actors to be included into the cache.
 
@@ -1117,50 +1118,73 @@ void InitializeTextActorInfo( TextView::RelayoutData& relayoutData )
               // Arrived at last line.
               lineLayoutEnd = true; // Avoids access out of bounds in the relayoutData.mLines vector.
             }
               // Arrived at last line.
               lineLayoutEnd = true; // Avoids access out of bounds in the relayoutData.mLines vector.
             }
-            textActorCreatedForLine = false;
+            glyphActorCreatedForLine = false;
           }
 
           if( !characterLayout.mStyledText.mText.IsEmpty() )
           {
           }
 
           if( !characterLayout.mStyledText.mText.IsEmpty() )
           {
-            // Do not create a text-actor if there is no text.
+            // Do not create a glyph-actor if there is no text.
             const Character character = characterLayout.mStyledText.mText[0]; // there are only one character per character layout.
 
             const Character character = characterLayout.mStyledText.mText[0]; // there are only one character per character layout.
 
-            if( !character.IsWhiteSpace() || // A new line character is also a white space.
+            if( characterLayout.mIsColorGlyph ||
+                !character.IsWhiteSpace() || // A new line character is also a white space.
                 ( character.IsWhiteSpace() && characterLayout.mStyledText.mStyle.GetUnderline() ) )
             {
                 ( character.IsWhiteSpace() && characterLayout.mStyledText.mStyle.GetUnderline() ) )
             {
-              // Do not create a text-actor if it's a white space (without underline) or a new line character.
+              // Do not create a glyph-actor if it's a white space (without underline) or a new line character.
 
 
-              // Creates one text-actor per each counsecutive group of characters, with the same style, per line.
+              // Creates one glyph-actor per each counsecutive group of characters, with the same style, per line, or if it's an emoticon.
 
 
-              if( !textActorCreatedForLine ||
+              if( !glyphActorCreatedForLine ||
+                  characterLayout.mIsColorGlyph ||
                   ( characterLayout.mStyledText.mStyle != currentStyle ) ||
                   ( characterLayout.mGradientColor != currentGradientColor ) ||
                   ( characterLayout.mStartPoint != currentStartPoint ) ||
                   ( characterLayout.mStyledText.mStyle != currentStyle ) ||
                   ( characterLayout.mGradientColor != currentGradientColor ) ||
                   ( characterLayout.mStartPoint != currentStartPoint ) ||
-                  ( characterLayout.mEndPoint != currentEndPoint ) )
+                  ( characterLayout.mEndPoint != currentEndPoint ) ||
+                  ( characterLayout.mIsColorGlyph != currentIsColorGlyph ) )
               {
               {
+                characterLayout.mSetText = false;
+                characterLayout.mSetStyle = false;
+
                 // There is a new style or a new line.
                 // There is a new style or a new line.
-                textActorCreatedForLine = true;
+                glyphActorCreatedForLine = true;
 
 
-                if( characterLayout.mTextActor )
+                if( characterLayout.mIsColorGlyph )
                 {
                 {
-                  // Try to reuse first the text-actor of this character.
-                  currentTextActor = characterLayout.mTextActor;
-                  currentTextActor.SetTextStyle( characterLayout.mStyledText.mStyle );
+                  ImageActor imageActor = ImageActor::DownCast( characterLayout.mGlyphActor );
+                  if( !imageActor )
+                  {
+                    characterLayout.mGlyphActor = ImageActor::New();
+                    characterLayout.mSetText = true;
+                  }
                 }
                 else
                 {
                 }
                 else
                 {
-                  // If there is no text-actor, try to retrieve one from the cache.
-                  currentTextActor = relayoutData.mTextActorCache.RetrieveTextActor();
+                  TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
 
 
-                  // If still there is no text-actor, create one.
-                  if( !currentTextActor )
+                  if( textActor )
                   {
                   {
-                    currentTextActor = TextActor::New( Text(), characterLayout.mStyledText.mStyle, false, true );
+                    // Try to reuse first the text-actor of this character.
+                    textActor.SetTextStyle( characterLayout.mStyledText.mStyle );
+                    currentGlyphActor = textActor;
                   }
                   else
                   {
                   }
                   else
                   {
-                    currentTextActor.SetTextStyle( characterLayout.mStyledText.mStyle );
+                    // If there is no text-actor, try to retrieve one from the cache.
+                    textActor = relayoutData.mTextActorCache.RetrieveTextActor();
+
+                    // If still there is no text-actor, create one.
+                    if( !textActor )
+                    {
+                      textActor = TextActor::New( Text(), characterLayout.mStyledText.mStyle, false, true );
+                    }
+                    else
+                    {
+                      textActor.SetTextStyle( characterLayout.mStyledText.mStyle );
+                    }
+
+                    currentGlyphActor = textActor;
                   }
                   }
+                  characterLayout.mGlyphActor = currentGlyphActor;
                 }
 
                 // Update style to be checked with next characters.
                 }
 
                 // Update style to be checked with next characters.
@@ -1168,24 +1192,28 @@ void InitializeTextActorInfo( TextView::RelayoutData& relayoutData )
                 currentGradientColor = characterLayout.mGradientColor;
                 currentStartPoint = characterLayout.mStartPoint;
                 currentEndPoint = characterLayout.mEndPoint;
                 currentGradientColor = characterLayout.mGradientColor;
                 currentStartPoint = characterLayout.mStartPoint;
                 currentEndPoint = characterLayout.mEndPoint;
+                currentIsColorGlyph = characterLayout.mIsColorGlyph;
 
 
-                characterLayout.mSetText = false;
-                characterLayout.mSetStyle = false;
-
-                characterLayout.mTextActor = currentTextActor;
-                characterLayout.mTextActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
-                characterLayout.mTextActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+                characterLayout.mGlyphActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+                characterLayout.mGlyphActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
               }
               else
               {
               }
               else
               {
+                DALI_ASSERT_DEBUG( !characterLayout.mIsColorGlyph && "TextViewProcessor::InitializeTextActorInfo. An image-actor doesn't store more than one emoticon." );
+
                 // Same style than previous one.
                 // Same style than previous one.
-                if( characterLayout.mTextActor )
+                TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
+                if( textActor )
                 {
                   // There is a previously created text-actor for this character.
                   // If this character has another one put it into the cache.
                 {
                   // There is a previously created text-actor for this character.
                   // If this character has another one put it into the cache.
-                  characterLayout.mTextActor.SetText( "" );
-                  textActorsToRemove.push_back( characterLayout.mTextActor );
-                  characterLayout.mTextActor.Reset();
+                  textActor.SetText( "" );
+                  textActorsToRemove.push_back( textActor );
+                }
+
+                if( characterLayout.mGlyphActor )
+                {
+                  characterLayout.mGlyphActor.Reset();
                 }
               }
             } // no white space / new line char
                 }
               }
             } // no white space / new line char
index eff5577..94a2998 100644 (file)
 // limitations under the License.
 //
 
 // limitations under the License.
 //
 
-// INTERNAL INCLUDES
+// FILE HEADER
 #include "text-view-word-processor.h"
 #include "text-view-word-processor.h"
+
+// INTERNAL INCLUDES
+#include <dali/dali.h>
 #include "text-view-processor-helper-functions.h"
 #include "text-view-processor-helper-functions.h"
+#include "text-view-processor-dbg.h"
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -95,6 +99,7 @@ WordLayoutInfo& WordLayoutInfo::operator=( const WordLayoutInfo& word )
 void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
                          TextViewProcessor::WordLayoutInfo& wordLayoutInfo )
 {
 void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
                          TextViewProcessor::WordLayoutInfo& wordLayoutInfo )
 {
+  DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "-->TextViewProcessor::CreateWordTextInfo\n" );
   // Split in characters.
   for( MarkupProcessor::StyledTextArray::const_iterator charIt = word.begin(), charEndIt = word.end(); charIt != charEndIt; ++charIt )
   {
   // Split in characters.
   for( MarkupProcessor::StyledTextArray::const_iterator charIt = word.begin(), charEndIt = word.end(); charIt != charEndIt; ++charIt )
   {
@@ -120,12 +125,15 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
       // Create layout character info.
       CharacterLayoutInfo characterLayoutInfo;
 
       // Create layout character info.
       CharacterLayoutInfo characterLayoutInfo;
 
+      characterLayoutInfo.mIsColorGlyph = GlyphImage::IsColorGlyph( character );
+      DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "  Is color glyph: %s\n", ( characterLayoutInfo.mIsColorGlyph ? "True" : "False" ) );
+
       // Fill Natural size info for current character.
       characterLayoutInfo.mHeight = font.GetLineHeight();
       characterLayoutInfo.mAdvance = metrics.GetAdvance();
       characterLayoutInfo.mBearing = metrics.GetBearing();
 
       // Fill Natural size info for current character.
       characterLayoutInfo.mHeight = font.GetLineHeight();
       characterLayoutInfo.mAdvance = metrics.GetAdvance();
       characterLayoutInfo.mBearing = metrics.GetBearing();
 
-      if( character.IsNewLine() )
+      if( character.IsNewLine() && !characterLayoutInfo.mIsColorGlyph )
       {
         // A new line character doesn't have any width.
         characterLayoutInfo.mSize.width = 0.f;
       {
         // A new line character doesn't have any width.
         characterLayoutInfo.mSize.width = 0.f;
@@ -155,6 +163,7 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
       wordLayoutInfo.mType = GetTextSeparatorType( character );
     } // end of each character in the group of characters.
   } // end of characters in the word.
       wordLayoutInfo.mType = GetTextSeparatorType( character );
     } // end of each character in the group of characters.
   } // end of characters in the word.
+  DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "<--TextViewProcessor::CreateWordTextInfo\n" );
 }
 
 void RemoveCharactersFromWordInfo( TextView::RelayoutData& relayoutData,
 }
 
 void RemoveCharactersFromWordInfo( TextView::RelayoutData& relayoutData,
@@ -377,9 +386,13 @@ void CollectTextActors( std::vector<TextActor>& textActors, const WordLayoutInfo
   {
     const CharacterLayoutInfo& characterLayout( *characterIt );
 
   {
     const CharacterLayoutInfo& characterLayout( *characterIt );
 
-    if( characterLayout.mTextActor )
+    if( !characterLayout.mIsColorGlyph )
     {
     {
-      textActors.push_back( characterLayout.mTextActor );
+      TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
+      if( textActor )
+      {
+        textActors.push_back( textActor );
+      }
     }
   }
 }
     }
   }
 }
@@ -398,9 +411,13 @@ void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const WordG
     {
       const CharacterLayoutInfo& characterLayout( *characterIt );
 
     {
       const CharacterLayoutInfo& characterLayout( *characterIt );
 
-      if( characterLayout.mTextActor )
+      if( !characterLayout.mIsColorGlyph )
       {
       {
-        textActors.push_back( characterLayout.mTextActor );
+        TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
+        if( textActor )
+        {
+          textActors.push_back( textActor );
+        }
       }
     }
   }
       }
     }
   }