[dali_1.0.8] Merge branch 'tizen'
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-word-processor.cpp
index a994407..6e3f8cc 100644 (file)
  */
 
 // FILE HEADER
-#include "text-view-word-processor.h"
+#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
 
 // INTERNAL INCLUDES
-#include <dali/dali.h>
-#include "text-view-processor-helper-functions.h"
-#include "text-view-processor-dbg.h"
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
 
 namespace Dali
 {
@@ -38,6 +37,8 @@ namespace TextViewProcessor
 namespace
 {
 
+const std::string EMOJI_FONT_NAME( "SamsungEmoji" ); // Emoticons font family name.
+
 /**
  * Updates the word size and ascender.
  *
@@ -116,19 +117,26 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
       Character character = styledText.mText[index];
       styledCharacter.mText.Append( character );
 
-      //Choose the right font for the given character and style.
-      ChooseFontFamilyName( styledCharacter );
-
-      const Font font = Font::New( FontParameters( styledCharacter.mStyle.GetFontName(), styledCharacter.mStyle.GetFontStyle(), styledCharacter.mStyle.GetFontPointSize() ) );
-      const Font::Metrics metrics = font.GetMetrics( character );
-      const float ascender = font.GetAscender();
-
       // 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" ) );
 
+      if( characterLayoutInfo.mIsColorGlyph )
+      {
+        styledCharacter.mStyle.SetFontName( EMOJI_FONT_NAME );
+      }
+      else
+      {
+        //Choose the right font for the given character and style.
+        ChooseFontFamilyName( styledCharacter );
+      }
+
+      const Font font = Font::New( FontParameters( styledCharacter.mStyle.GetFontName(), styledCharacter.mStyle.GetFontStyle(), styledCharacter.mStyle.GetFontPointSize() ) );
+      const Font::Metrics metrics = font.GetMetrics( character );
+      const float ascender = font.GetAscender();
+
       // Fill Natural size info for current character.
       characterLayoutInfo.mHeight = font.GetLineHeight();
       characterLayoutInfo.mAdvance = metrics.GetAdvance();
@@ -147,7 +155,7 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
       characterLayoutInfo.mSize.height = characterLayoutInfo.mHeight;
       characterLayoutInfo.mAscender = ascender;
 
-      if( styledCharacter.mStyle.GetUnderline() )
+      if( styledCharacter.mStyle.IsUnderlineEnabled() )
       {
         characterLayoutInfo.mUnderlineThickness = font.GetUnderlineThickness(); // Both thickness and position includes the
         characterLayoutInfo.mUnderlinePosition = font.GetUnderlinePosition();   // vertical pad adjust used in effects like glow or shadow.