Conversion to Apache 2.0 license
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-word-processor.cpp
index 94a2998..2e7ff3b 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // FILE HEADER
 #include "text-view-word-processor.h"
 
 // FILE HEADER
 #include "text-view-word-processor.h"
@@ -37,6 +38,8 @@ namespace TextViewProcessor
 namespace
 {
 
 namespace
 {
 
+const std::string EMOJI_FONT_NAME( "SamsungEmoji" ); // Emoticons font family name.
+
 /**
  * Updates the word size and ascender.
  *
 /**
  * Updates the word size and ascender.
  *
@@ -115,19 +118,26 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
       Character character = styledText.mText[index];
       styledCharacter.mText.Append( character );
 
       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" ) );
 
       // 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();
       // Fill Natural size info for current character.
       characterLayoutInfo.mHeight = font.GetLineHeight();
       characterLayoutInfo.mAdvance = metrics.GetAdvance();