+/**
+ * Creates an image actor for the emoticon.
+ *
+ * @param[in] visualParameters Some visual parameters (fade, sort modifier and blending).
+ * @param[in,out] characterLayout Layout info for the character.
+ * @param[in] character The character.
+ */
+void CreateEmoticon( const TextView::VisualParameters& visualParameters,
+ TextViewProcessor::CharacterLayoutInfo& characterLayout,
+ const Character& character )
+{
+ // The character is an emoticon.
+ ImageActor imageActor = ImageActor::DownCast( characterLayout.mGlyphActor );
+ if( !imageActor )
+ {
+ imageActor = ImageActor::New();
+
+ GlyphImage image = GlyphImage::New( character );
+
+ if( image )
+ {
+ imageActor.SetImage( image );
+ }
+ }
+
+ imageActor.SetPosition( Vector3( characterLayout.mPosition.x + characterLayout.mOffset.x,
+ characterLayout.mPosition.y + characterLayout.mOffset.y,
+ characterLayout.mPosition.z ) );
+ imageActor.SetSize( characterLayout.mSize );
+
+ // Sets the sort modifier value.
+ imageActor.SetSortModifier( visualParameters.mSortModifier );
+
+ characterLayout.mGlyphActor = imageActor;
+}
+
+/**
+ * Creates text-actors for the given text.
+ *
+ * @param[in] visualParameters Some visual parameters (fade, sort modifier and blending).
+ * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
+ * @param[in,out] line Layout info for the line.
+ * @param[in,out] characterLayout Layout info for the character.
+ * @param[in] character The character.
+ * @param[in] style The character's style.
+ * @param[in,out] currentTextActorInfo Temporary stores the text-actor's info to be set.
+ * @param[in,out] createGlyphActors Whether to initialize renderable-actor handles.
+ */
+void CreateTextActor( const TextView::VisualParameters& visualParameters,
+ TextView::RelayoutData& relayoutData,
+ const TextViewProcessor::LineLayoutInfo& line,
+ TextViewProcessor::CharacterLayoutInfo& characterLayout,
+ const Character& character,
+ const TextStyle& style,
+ CurrentTextActorInfo& currentTextActorInfo,
+ bool createGlyphActors )
+{
+ // Set the text-actor for the current traversed text.
+ if( currentTextActorInfo.textActor )
+ {
+ currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
+ currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
+ currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
+
+ SetVisualParameters( currentTextActorInfo,
+ visualParameters,
+ relayoutData,
+ line.mSize.height );
+ }
+
+ currentTextActorInfo.text = Text( character );
+ currentTextActorInfo.position = Vector3( characterLayout.mPosition.x + characterLayout.mOffset.x,
+ characterLayout.mPosition.y + characterLayout.mOffset.y,
+ characterLayout.mPosition.z );
+ currentTextActorInfo.size = characterLayout.mSize * relayoutData.mShrinkFactor;
+
+ currentTextActorInfo.color = style.GetTextColor();
+ currentTextActorInfo.color.a = characterLayout.mColorAlpha;
+
+ currentTextActorInfo.gradientColor = characterLayout.mGradientColor;
+ currentTextActorInfo.startPoint = characterLayout.mStartPoint;
+ currentTextActorInfo.endPoint = characterLayout.mEndPoint;
+
+ TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
+
+ if( createGlyphActors )
+ {
+ if( textActor )
+ {
+ // Try to reuse first the text-actor of this character.
+ textActor.SetTextStyle( style );
+ }
+ else
+ {
+ // 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 )
+ {
+ TextActorParameters parameters( style, TextActorParameters::FONT_DETECTION_OFF );
+ textActor = TextActor::New( Text(), parameters );
+ }
+ else
+ {
+ textActor.SetTextStyle( style );
+ }
+ }
+ characterLayout.mGlyphActor = textActor;
+ }
+
+ // Update the current text-actor.
+ currentTextActorInfo.textActor = textActor;
+}
+
+/**
+ * Traverses the whole line initializating renderable-actor handles and updating them with the new size and position.
+ *
+ * @param[in] visualParameters Some visual parameters (fade, sort modifier and blending).
+ * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
+ * @param[in,out] line Layout info for the line.
+ * @param[in,out] characterGlobalIndex Index to the character within the whole text.
+ * @param[in,out] lineLayoutInfoIndex Index to the table of laid out lines.
+ * @param[in,out] createGlyphActors Whether to initialize renderable-actor handles.
+ */
+void UpdateTextActorInfoForLine( const TextView::VisualParameters& visualParameters,
+ TextView::RelayoutData& relayoutData,
+ TextViewProcessor::LineLayoutInfo& line,
+ std::size_t& characterGlobalIndex,
+ std::size_t& lineLayoutInfoIndex,
+ bool createGlyphActors )