Fix for color emojis fonts. 89/75989/4
authorVictor Cebollada <v.cebollada@samsung.com>
Tue, 21 Jun 2016 16:16:16 +0000 (17:16 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Thu, 30 Jun 2016 13:13:45 +0000 (14:13 +0100)
* Uses the fixed size to generate the glyphs but uses
  the point size given by the user to cache the font
  and generate the metrics.

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

index 3460dff..e805fb4 100644 (file)
@@ -93,27 +93,27 @@ PointSize26Dot6 FontClient::GetPointSize( FontId id )
   return GetImplementation(*this).GetPointSize( id );
 }
 
-FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor )
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor )
 {
-  return GetImplementation(*this).FindDefaultFont( charcode, pointSize, preferColor );
+  return GetImplementation(*this).FindDefaultFont( charcode, requestedPointSize, preferColor );
 }
 
-FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 pointSize, bool preferColor )
+FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor )
 {
-  return GetImplementation(*this).FindFallbackFont( preferredFont, charcode, pointSize, preferColor );
+  return GetImplementation(*this).FindFallbackFont( preferredFont, charcode, requestedPointSize, preferColor );
 }
 
-FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
 {
-  return GetImplementation(*this).GetFontId( path, pointSize, faceIndex );
+  return GetImplementation(*this).GetFontId( path, requestedPointSize, faceIndex );
 }
 
 FontId FontClient::GetFontId( const FontDescription& fontDescription,
-                              PointSize26Dot6 pointSize,
+                              PointSize26Dot6 requestedPointSize,
                               FaceIndex faceIndex )
 {
   return GetImplementation(*this).GetFontId( fontDescription,
-                                             pointSize,
+                                             requestedPointSize,
                                              faceIndex );
 }
 
@@ -138,9 +138,9 @@ void FontClient::GetFixedSizes( const FontDescription& fontDescription,
   GetImplementation(*this).GetFixedSizes( fontDescription, sizes );
 }
 
-void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize )
+void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
 {
-  GetImplementation(*this).GetFontMetrics( fontId, metrics, desiredFixedSize );
+  GetImplementation(*this).GetFontMetrics( fontId, metrics );
 }
 
 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
@@ -148,9 +148,9 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
   return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
 }
 
-bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal, int desiredFixedSize )
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal )
 {
-  return GetImplementation(*this).GetGlyphMetrics( array, size, type, horizontal, desiredFixedSize );
+  return GetImplementation(*this).GetGlyphMetrics( array, size, type, horizontal );
 }
 
 BufferImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
@@ -163,9 +163,9 @@ void FontClient::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorB
   GetImplementation(*this).CreateVectorBlob( fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight );
 }
 
-const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 pointSize )
+const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
 {
-  return GetImplementation(*this).GetEllipsisGlyph( pointSize );
+  return GetImplementation(*this).GetEllipsisGlyph( requestedPointSize );
 }
 
 FontClient::FontClient( Internal::FontClient* internal )
index 2614cfc..56e9245 100644 (file)
@@ -172,12 +172,12 @@ public:
    * This is useful when localised strings are provided for multiple languages
    * i.e. when a single default font does not work for all languages.
    * @param[in] charcode The character for which a font is needed.
-   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64.
    * @param[in] preferColor True if a color font is preferred.
    * @return A valid font ID, or zero if the font does not exist.
    */
   FontId FindDefaultFont( Character charcode,
-                          PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+                          PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE,
                           bool preferColor = false );
 
   /**
@@ -188,25 +188,25 @@ public:
    * @param[in] preferredFont The preferred font which may not provide a glyph for charcode.
    * The fallback-font will be the closest match to preferredFont, which does support the required glyph.
    * @param[in] charcode The character for which a font is needed.
-   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64.
    * @param[in] preferColor True if a color font is preferred.
    * @return A valid font ID, or zero if the font does not exist.
    */
   FontId FindFallbackFont( FontId preferredFont,
                            Character charcode,
-                           PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+                           PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE,
                            bool preferColor = false );
 
   /**
    * @brief Retrieve the unique identifier for a font.
    *
    * @param[in] path The path to a font file.
-   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64.
    * @param[in] faceIndex The index of the font face (optional).
    * @return A valid font ID, or zero if the font does not exist.
    */
   FontId GetFontId( const FontPath& path,
-                    PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+                    PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE,
                     FaceIndex faceIndex = 0 );
 
   /**
@@ -215,12 +215,12 @@ public:
    * @note It the font style is not empty, it will be used instead the font weight and font slant slant.
    *
    * @param[in] fontDescription A font description.
-   * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
+   * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64.
    * @param[in] faceIndex The index of the font face (optional).
    * @return A valid font ID, or zero if the font does not exist.
    */
   FontId GetFontId( const FontDescription& fontDescription,
-                    PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+                    PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE,
                     FaceIndex faceIndex = 0 );
 
   /**
@@ -270,9 +270,8 @@ public:
    *
    * @param[in] fontId The ID of the font for the required glyph.
    * @param[out] metrics The font metrics.
-   * @param[in] desiredFixedSize The metrics for fixed-size fonts will be scaled to this desired size (in pixels).
    */
-  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize = 0 );
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics );
 
   /**
    * @brief Retrieve the glyph index for a UTF-32 character code.
@@ -292,10 +291,9 @@ public:
    * @param[in] size The size of the array.
    * @param[in] type The type of glyphs used for rendering; either bitmaps or vectors.
    * @param[in] horizontal True for horizontal layouts (set to false for vertical layouting).
-   * @param[in] desiredFixedSize The metrics for fixed-size fonts will be scaled to this desired size (in pixels).
    * @return True if all of the requested metrics were found.
    */
-  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal = true, int desiredFixedSize = 0 );
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal = true );
 
   /**
    * @brief Create a bitmap representation of a glyph.
@@ -327,11 +325,11 @@ public:
   /**
    * @brief Retrieves the ellipsis glyph for a requested point size.
    *
-   * @param[in] pointSize The requested point size.
+   * @param[in] requestedPointSize The requested point size.
    *
    * @return The ellipsis glyph.
    */
-  const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 pointSize );
+  const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 requestedPointSize );
 
 public: // Not intended for application developers
   /**
index dbf4076..94d8bd3 100644 (file)
@@ -128,18 +128,18 @@ void FontClient::GetSystemFonts( FontList& systemFonts )
   mPlugin->GetSystemFonts( systemFonts );
 }
 
-FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor )
+FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor )
 {
   CreatePlugin();
 
-  return mPlugin->FindDefaultFont( charcode, pointSize, preferColor );
+  return mPlugin->FindDefaultFont( charcode, requestedPointSize, preferColor );
 }
 
-FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 pointSize, bool preferColor )
+FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor )
 {
   CreatePlugin();
 
-  return mPlugin->FindFallbackFont( preferredFont, charcode, pointSize, preferColor );
+  return mPlugin->FindFallbackFont( preferredFont, charcode, requestedPointSize, preferColor );
 }
 
 bool FontClient::IsScalable( const FontPath& path )
@@ -171,29 +171,33 @@ void FontClient::GetFixedSizes( const FontDescription& fontDescription,
   mPlugin->GetFixedSizes( fontDescription, sizes );
 }
 
-FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
 {
   CreatePlugin();
 
-  return mPlugin->GetFontId( path, pointSize, faceIndex );
+  return mPlugin->GetFontId( path,
+                             requestedPointSize,
+                             requestedPointSize,
+                             faceIndex );
 }
 
 FontId FontClient::GetFontId( const FontDescription& fontDescription,
-                              PointSize26Dot6 pointSize,
+                              PointSize26Dot6 requestedPointSize,
                               FaceIndex faceIndex )
 {
   CreatePlugin();
 
   return mPlugin->GetFontId( fontDescription,
-                             pointSize,
+                             requestedPointSize,
+                             requestedPointSize,
                              faceIndex );
 }
 
-void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize )
+void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
 {
   CreatePlugin();
 
-  return mPlugin->GetFontMetrics( fontId, metrics, desiredFixedSize );
+  return mPlugin->GetFontMetrics( fontId, metrics );
 }
 
 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
@@ -203,11 +207,11 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
   return mPlugin->GetGlyphIndex( fontId, charcode );
 }
 
-bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal, int desiredFixedSize )
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal )
 {
   CreatePlugin();
 
-  return mPlugin->GetGlyphMetrics( array, size, type, horizontal, desiredFixedSize );
+  return mPlugin->GetGlyphMetrics( array, size, type, horizontal );
 }
 
 BufferImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
@@ -224,11 +228,11 @@ void FontClient::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorB
   return mPlugin->CreateVectorBlob( fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight );
 }
 
-const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 pointSize )
+const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
 {
   CreatePlugin();
 
-  return mPlugin->GetEllipsisGlyph( pointSize );
+  return mPlugin->GetEllipsisGlyph( requestedPointSize );
 }
 
 void FontClient::CreatePlugin()
index 8cc77ad..8d51498 100644 (file)
@@ -98,23 +98,23 @@ public:
   /**
    * @copydoc Dali::FontClient::FindDefaultFont()
    */
-  FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor );
+  FontId FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor );
 
   /**
    * @copydoc Dali::FontClient::FindFallbackFont()
    */
-  FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 pointSize, bool preferColor );
+  FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor );
 
   /**
-   * @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   * @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
    */
-  FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
+  FontId GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex );
 
   /**
-   * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
    */
   FontId GetFontId( const FontDescription& fontDescription,
-                    PointSize26Dot6 pointSize,
+                    PointSize26Dot6 requestedPointSize,
                     FaceIndex faceIndex );
 
   /**
@@ -141,7 +141,7 @@ public:
   /**
    * @copydoc Dali::FontClient::GetFontMetrics()
    */
-  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize );
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics );
 
   /**
    * @copydoc Dali::FontClient::GetGlyphIndex()
@@ -151,7 +151,7 @@ public:
   /**
    * @copydoc Dali::FontClient::GetGlyphMetrics()
    */
-  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal, int desiredFixedSize );
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal );
 
   /**
    * @copydoc Dali::FontClient::CreateBitmap()
@@ -166,7 +166,7 @@ public:
   /**
    * @copydoc Dali::FontClient::GetEllipsisGlyph()
    */
-  const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 pointSize );
+  const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 requestedPointSize );
 
 private:
 
index d1ea359..d24f671 100644 (file)
@@ -41,6 +41,7 @@ Dali::Integration::Log::Filter* gLogFilter = Dali::Integration::Log::Filter::New
  * Conversion from Fractional26.6 to float
  */
 const float FROM_266 = 1.0f / 64.0f;
+const float POINTS_PER_INCH = 72.f;
 
 const std::string FONT_FORMAT( "TrueType" );
 const std::string DEFAULT_FONT_FAMILY_NAME( "Tizen" );
@@ -149,22 +150,22 @@ FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const Fo
 }
 
 FontClient::Plugin::FontIdCacheItem::FontIdCacheItem( FontDescriptionId validatedFontId,
-                                                      PointSize26Dot6 pointSize,
+                                                      PointSize26Dot6 requestedPointSize,
                                                       FontId fontId )
 : validatedFontId( validatedFontId ),
-  pointSize( pointSize ),
+  requestedPointSize( requestedPointSize ),
   fontId( fontId )
 {
 }
 
 FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace,
                                           const FontPath& path,
-                                          PointSize26Dot6 pointSize,
+                                          PointSize26Dot6 requestedPointSize,
                                           FaceIndex face,
                                           const FontMetrics& metrics )
 : mFreeTypeFace( ftFace ),
   mPath( path ),
-  mPointSize( pointSize ),
+  mRequestedPointSize( requestedPointSize ),
   mFaceIndex( face ),
   mMetrics( metrics ),
   mFixedWidthPixels( 0.0f ),
@@ -176,14 +177,14 @@ FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace,
 
 FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace,
                                           const FontPath& path,
-                                          PointSize26Dot6 pointSize,
+                                          PointSize26Dot6 requestedPointSize,
                                           FaceIndex face,
                                           const FontMetrics& metrics,
                                           float fixedWidth,
                                           float fixedHeight )
 : mFreeTypeFace( ftFace ),
   mPath( path ),
-  mPointSize( pointSize ),
+  mRequestedPointSize( requestedPointSize ),
   mFaceIndex( face ),
   mMetrics( metrics ),
   mFixedWidthPixels( fixedWidth ),
@@ -390,7 +391,7 @@ PointSize26Dot6 FontClient::Plugin::GetPointSize( FontId id )
   if( id > 0u &&
       index < mFontCache.size() )
   {
-    return ( *( mFontCache.begin() + index ) ).mPointSize;
+    return ( *( mFontCache.begin() + index ) ).mRequestedPointSize;
   }
   else
   {
@@ -402,7 +403,7 @@ PointSize26Dot6 FontClient::Plugin::GetPointSize( FontId id )
 
 FontId FontClient::Plugin::FindFontForCharacter( const FontList& fontList,
                                                  Character charcode,
-                                                 PointSize26Dot6 requestedSize,
+                                                 PointSize26Dot6 requestedPointSize,
                                                  bool preferColor )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::FindFontForCharacter\n");
@@ -433,24 +434,27 @@ FontId FontClient::Plugin::FindFontForCharacter( const FontList& fontList,
       GetFixedSizes( description,
                      fixedSizes );
 
+      PointSize26Dot6 actualPointSize = requestedPointSize;
+
       const Vector< PointSize26Dot6 >::SizeType count = fixedSizes.Count();
+
       if( 0 != count )
       {
-        // If the font is not scalable, pick the largest size <= requestedSize
-        PointSize26Dot6 size = fixedSizes[0];
+        // If the font is not scalable, pick the largest size <= requestedPointSize
+        actualPointSize = fixedSizes[0];
         for( unsigned int i=1; i<count; ++i )
         {
-          if( fixedSizes[i] <= requestedSize &&
-              fixedSizes[i] > size )
+          if( fixedSizes[i] <= requestedPointSize &&
+              fixedSizes[i] > actualPointSize )
           {
-            size = fixedSizes[i];
+            actualPointSize = fixedSizes[i];
           }
         }
-        requestedSize = size;
       }
 
       fontId = GetFontId( description,
-                          requestedSize,
+                          requestedPointSize,
+                          actualPointSize,
                           0u );
 
       if( preferColor )
@@ -480,7 +484,7 @@ FontId FontClient::Plugin::FindFontForCharacter( const FontList& fontList,
 }
 
 FontId FontClient::Plugin::FindDefaultFont( Character charcode,
-                                            PointSize26Dot6 requestedSize,
+                                            PointSize26Dot6 requestedPointSize,
                                             bool preferColor )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::FindDefaultFont DefaultFontsList(%s)\n", (mDefaultFonts.empty()?"empty":"created") );
@@ -500,14 +504,14 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode,
 
   // Traverse the list of default fonts.
   // Check for each default font if supports the character.
-  fontId = FindFontForCharacter( mDefaultFonts, charcode, requestedSize, preferColor );
+  fontId = FindFontForCharacter( mDefaultFonts, charcode, requestedPointSize, preferColor );
 
   return fontId;
 }
 
 FontId FontClient::Plugin::FindFallbackFont( FontId preferredFont,
                                              Character charcode,
-                                             PointSize26Dot6 requestedSize,
+                                             PointSize26Dot6 requestedPointSize,
                                              bool preferColor )
 {
   // The font id to be returned.
@@ -530,14 +534,15 @@ FontId FontClient::Plugin::FindFallbackFont( FontId preferredFont,
 
   if( fontList )
   {
-    fontId = FindFontForCharacter( *fontList, charcode, requestedSize, preferColor );
+    fontId = FindFontForCharacter( *fontList, charcode, requestedPointSize, preferColor );
   }
 
   return fontId;
 }
 
 FontId FontClient::Plugin::GetFontId( const FontPath& path,
-                                      PointSize26Dot6 pointSize,
+                                      PointSize26Dot6 requestedPointSize,
+                                      PointSize26Dot6 actualPointSize,
                                       FaceIndex faceIndex,
                                       bool cacheDescription )
 {
@@ -548,13 +553,13 @@ FontId FontClient::Plugin::GetFontId( const FontPath& path,
   if( NULL != mFreeTypeLibrary )
   {
     FontId foundId(0);
-    if( FindFont( path, pointSize, faceIndex, foundId ) )
+    if( FindFont( path, requestedPointSize, faceIndex, foundId ) )
     {
       id = foundId;
     }
     else
     {
-      id = CreateFont( path, pointSize, faceIndex, cacheDescription );
+      id = CreateFont( path, requestedPointSize, actualPointSize, faceIndex, cacheDescription );
     }
   }
 
@@ -562,7 +567,8 @@ FontId FontClient::Plugin::GetFontId( const FontPath& path,
 }
 
 FontId FontClient::Plugin::GetFontId( const FontDescription& fontDescription,
-                                      PointSize26Dot6 pointSize,
+                                      PointSize26Dot6 requestedPointSize,
+                                      PointSize26Dot6 actualPointSize,
                                       FaceIndex faceIndex )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::GetFontId font family(%s)\n", fontDescription.family.c_str() );
@@ -598,21 +604,22 @@ FontId FontClient::Plugin::GetFontId( const FontDescription& fontDescription,
                   validatedFontId );
   }
 
-  // Check if exists a pair 'validatedFontId, pointSize' in the cache.
-  if( !FindFont( validatedFontId, pointSize, fontId ) )
+  // Check if exists a pair 'validatedFontId, requestedPointSize' in the cache.
+  if( !FindFont( validatedFontId, requestedPointSize, fontId ) )
   {
     // Retrieve the font file name path.
     const FontDescription& description = *( mFontDescriptionCache.begin() + validatedFontId );
 
     // Retrieve the font id. Do not cache the description as it has been already cached.
     fontId = GetFontId( description.path,
-                        pointSize,
+                        requestedPointSize,
+                        actualPointSize,
                         faceIndex,
                         false );
 
-    // Cache the pair 'validatedFontId, pointSize' to improve the following queries.
+    // Cache the pair 'validatedFontId, requestedPointSize' to improve the following queries.
     mFontIdCache.push_back( FontIdCacheItem( validatedFontId,
-                                             pointSize,
+                                             requestedPointSize,
                                              fontId ) );
   }
 
@@ -671,27 +678,30 @@ void FontClient::Plugin::ValidateFont( const FontDescription& fontDescription,
 }
 
 void FontClient::Plugin::GetFontMetrics( FontId fontId,
-                                         FontMetrics& metrics,
-                                         int desiredFixedSize )
+                                         FontMetrics& metrics )
 {
-  if( fontId > 0 &&
-      fontId-1 < mFontCache.size() )
+  if( ( fontId > 0 ) &&
+      ( fontId - 1u < mFontCache.size() ) )
   {
     const CacheItem& font = mFontCache[fontId-1];
 
     metrics = font.mMetrics;
 
     // Adjust the metrics if the fixed-size font should be down-scaled
-    if( font.mIsFixedSizeBitmap &&
-        ( desiredFixedSize > 0 ) )
+    if( font.mIsFixedSizeBitmap )
     {
-      float scaleFactor = static_cast<float>(desiredFixedSize) / static_cast<float>(font.mFixedHeightPixels);
+      const float desiredFixedSize =  static_cast<float>( font.mRequestedPointSize ) * FROM_266 / POINTS_PER_INCH * mDpiVertical;
+
+      if( desiredFixedSize > 0.f )
+      {
+        const float scaleFactor = desiredFixedSize / static_cast<float>( font.mFixedHeightPixels );
 
-      metrics.ascender           *= scaleFactor;
-      metrics.descender          *= scaleFactor;
-      metrics.height             *= scaleFactor;
-      metrics.underlinePosition  *= scaleFactor;
-      metrics.underlineThickness *= scaleFactor;
+        metrics.ascender = floorf( metrics.ascender * scaleFactor );
+        metrics.descender = floorf( metrics.descender * scaleFactor );
+        metrics.height = floorf( metrics.height * scaleFactor );
+        metrics.underlinePosition = floorf( metrics.underlinePosition * scaleFactor );
+        metrics.underlineThickness = floorf( metrics.underlineThickness * scaleFactor );
+      }
     }
   }
   else
@@ -719,27 +729,27 @@ GlyphIndex FontClient::Plugin::GetGlyphIndex( FontId fontId,
 bool FontClient::Plugin::GetGlyphMetrics( GlyphInfo* array,
                                           uint32_t size,
                                           GlyphType type,
-                                          bool horizontal,
-                                          int desiredFixedSize )
+                                          bool horizontal )
 {
   if( VECTOR_GLYPH == type )
   {
-    return GetVectorMetrics( array, size, horizontal, desiredFixedSize );
+    return GetVectorMetrics( array, size, horizontal );
   }
 
-  return GetBitmapMetrics( array, size, horizontal, desiredFixedSize );
+  return GetBitmapMetrics( array, size, horizontal );
 }
 
 bool FontClient::Plugin::GetBitmapMetrics( GlyphInfo* array,
                                            uint32_t size,
-                                           bool horizontal,
-                                           int desiredFixedSize )
+                                           bool horizontal )
 {
   bool success( true );
 
   for( unsigned int i=0; i<size; ++i )
   {
-    FontId fontId = array[i].fontId;
+    GlyphInfo& glyph = array[i];
+
+    FontId fontId = glyph.fontId;
 
     if( fontId > 0 &&
         fontId-1 < mFontCache.size() )
@@ -752,27 +762,29 @@ bool FontClient::Plugin::GetBitmapMetrics( GlyphInfo* array,
       // Check to see if we should be loading a Fixed Size bitmap?
       if ( font.mIsFixedSizeBitmap )
       {
-        int error = FT_Load_Glyph( ftFace, array[i].index, FT_LOAD_COLOR );
+        int error = FT_Load_Glyph( ftFace, glyph.index, FT_LOAD_COLOR );
         if ( FT_Err_Ok == error )
         {
-          array[i].width = font.mFixedWidthPixels;
-          array[i].height = font.mFixedHeightPixels;
-          array[i].advance = font.mFixedWidthPixels;
-          array[i].xBearing = 0.0f;
-          array[i].yBearing = font.mFixedHeightPixels;
+          glyph.width = font.mFixedWidthPixels;
+          glyph.height = font.mFixedHeightPixels;
+          glyph.advance = font.mFixedWidthPixels;
+          glyph.xBearing = 0.0f;
+          glyph.yBearing = font.mFixedHeightPixels;
 
           // Adjust the metrics if the fixed-size font should be down-scaled
-          if( desiredFixedSize > 0 )
+          const float desiredFixedSize =  static_cast<float>( font.mRequestedPointSize ) * FROM_266 / POINTS_PER_INCH * mDpiVertical;
+
+          if( desiredFixedSize > 0.f )
           {
-            float scaleFactor = static_cast<float>(desiredFixedSize) / static_cast<float>(font.mFixedHeightPixels);
+            const float scaleFactor = desiredFixedSize / static_cast<float>( font.mFixedHeightPixels );
 
-            array[i].width    *= scaleFactor;
-            array[i].height   *= scaleFactor;
-            array[i].advance  *= scaleFactor;
-            array[i].xBearing *= scaleFactor;
-            array[i].yBearing *= scaleFactor;
+            glyph.width = floorf( glyph.width * scaleFactor );
+            glyph.height = floorf( glyph.height * scaleFactor );
+            glyph.advance = floorf( glyph.advance * scaleFactor );
+            glyph.xBearing = floorf( glyph.xBearing * scaleFactor );
+            glyph.yBearing = floorf( glyph.yBearing * scaleFactor );
 
-            array[i].scaleFactor = scaleFactor;
+            glyph.scaleFactor = scaleFactor;
           }
         }
         else
@@ -784,21 +796,21 @@ bool FontClient::Plugin::GetBitmapMetrics( GlyphInfo* array,
       else
 #endif
       {
-        int error = FT_Load_Glyph( ftFace, array[i].index, FT_LOAD_DEFAULT );
+        int error = FT_Load_Glyph( ftFace, glyph.index, FT_LOAD_DEFAULT );
 
         if( FT_Err_Ok == error )
         {
-          array[i].width  = static_cast< float >( ftFace->glyph->metrics.width ) * FROM_266;
-          array[i].height = static_cast< float >( ftFace->glyph->metrics.height ) * FROM_266 ;
+          glyph.width  = static_cast< float >( ftFace->glyph->metrics.width ) * FROM_266;
+          glyph.height = static_cast< float >( ftFace->glyph->metrics.height ) * FROM_266 ;
           if( horizontal )
           {
-            array[i].xBearing += static_cast< float >( ftFace->glyph->metrics.horiBearingX ) * FROM_266;
-            array[i].yBearing += static_cast< float >( ftFace->glyph->metrics.horiBearingY ) * FROM_266;
+            glyph.xBearing += static_cast< float >( ftFace->glyph->metrics.horiBearingX ) * FROM_266;
+            glyph.yBearing += static_cast< float >( ftFace->glyph->metrics.horiBearingY ) * FROM_266;
           }
           else
           {
-            array[i].xBearing += static_cast< float >( ftFace->glyph->metrics.vertBearingX ) * FROM_266;
-            array[i].yBearing += static_cast< float >( ftFace->glyph->metrics.vertBearingY ) * FROM_266;
+            glyph.xBearing += static_cast< float >( ftFace->glyph->metrics.vertBearingX ) * FROM_266;
+            glyph.yBearing += static_cast< float >( ftFace->glyph->metrics.vertBearingY ) * FROM_266;
           }
         }
         else
@@ -818,8 +830,7 @@ bool FontClient::Plugin::GetBitmapMetrics( GlyphInfo* array,
 
 bool FontClient::Plugin::GetVectorMetrics( GlyphInfo* array,
                                            uint32_t size,
-                                           bool horizontal,
-                                           int desiredFixedSize )
+                                           bool horizontal )
 {
 #ifdef ENABLE_VECTOR_BASED_TEXT_RENDERING
   bool success( true );
@@ -841,7 +852,7 @@ bool FontClient::Plugin::GetVectorMetrics( GlyphInfo* array,
       mVectorFontCache->GetGlyphMetrics( font.mVectorFontId, array[i] );
 
       // Vector metrics are in EMs, convert to pixels
-      float scale = (static_cast<float>(font.mPointSize)/64.0f) * mDpiVertical/72.0f;
+      const float scale = ( static_cast<float>( font.mRequestedPointSize ) * FROM_266 ) * static_cast<float>( mDpiVertical ) / POINTS_PER_INCH;
       array[i].width    *= scale;
       array[i].height   *= scale;
       array[i].xBearing *= scale;
@@ -943,7 +954,7 @@ void FontClient::Plugin::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex,
 #endif
 }
 
-const GlyphInfo& FontClient::Plugin::GetEllipsisGlyph( PointSize26Dot6 pointSize )
+const GlyphInfo& FontClient::Plugin::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
 {
   // First look into the cache if there is an ellipsis glyph for the requested point size.
   for( Vector<EllipsisItem>::ConstIterator it = mEllipsisCache.Begin(),
@@ -953,7 +964,7 @@ const GlyphInfo& FontClient::Plugin::GetEllipsisGlyph( PointSize26Dot6 pointSize
   {
     const EllipsisItem& item = *it;
 
-    if( fabsf( item.size - pointSize ) < Math::MACHINE_EPSILON_1000 )
+    if( fabsf( item.requestedPointSize - requestedPointSize ) < Math::MACHINE_EPSILON_1000 )
     {
       // Use the glyph in the cache.
       return item.glyph;
@@ -964,18 +975,18 @@ const GlyphInfo& FontClient::Plugin::GetEllipsisGlyph( PointSize26Dot6 pointSize
   mEllipsisCache.PushBack( EllipsisItem() );
   EllipsisItem& item = *( mEllipsisCache.End() - 1u );
 
-  item.size = pointSize;
+  item.requestedPointSize = requestedPointSize;
 
   // Find a font for the ellipsis glyph.
   item.glyph.fontId = FindDefaultFont( ELLIPSIS_CHARACTER,
-                                       pointSize,
+                                       requestedPointSize,
                                        false );
 
   // Set the character index to access the glyph inside the font.
   item.glyph.index = FT_Get_Char_Index( mFontCache[item.glyph.fontId-1].mFreeTypeFace,
                                         ELLIPSIS_CHARACTER );
 
-  GetBitmapMetrics( &item.glyph, 1u, true, 0 );
+  GetBitmapMetrics( &item.glyph, 1u, true );
 
   return item.glyph;
 }
@@ -1144,7 +1155,8 @@ bool FontClient::Plugin::GetFcInt( const _FcPattern* const pattern, const char*
 }
 
 FontId FontClient::Plugin::CreateFont( const FontPath& path,
-                                       PointSize26Dot6 pointSize,
+                                       PointSize26Dot6 requestedPointSize,
+                                       PointSize26Dot6 actualPointSize,
                                        FaceIndex faceIndex,
                                        bool cacheDescription )
 {
@@ -1165,7 +1177,7 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
       // Ensure this size is available
       for ( int i = 0; i < ftFace->num_fixed_sizes; ++i )
       {
-        if ( static_cast<FT_Pos>(pointSize) == ftFace->available_sizes[ i ].size )
+        if ( static_cast<FT_Pos>( actualPointSize ) == ftFace->available_sizes[ i ].size )
         {
           // Tell Freetype to use this size
           error = FT_Select_Size( ftFace, i );
@@ -1185,13 +1197,14 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
                                  0.0f,
                                  0.0f );
 
-            mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics, fixedWidth, fixedHeight ) );
+            mFontCache.push_back( CacheItem( ftFace, path, requestedPointSize, faceIndex, metrics, fixedWidth, fixedHeight ) );
             id = mFontCache.size();
 
             if( cacheDescription )
             {
-              CacheFontPath( ftFace, id, pointSize, path );
+              CacheFontPath( ftFace, id, requestedPointSize, path );
             }
+
             return id;
           }
         }
@@ -1208,13 +1221,13 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
         sizes << ftFace->available_sizes[ i ].size;
       }
       DALI_LOG_ERROR( "FreeType Font: %s, does not contain Bitmaps of size: %d. Available sizes are: %s\n",
-                       path.c_str(), pointSize, sizes.str().c_str() );
+                       path.c_str(), actualPointSize, sizes.str().c_str() );
     }
     else
     {
       error = FT_Set_Char_Size( ftFace,
                                 0,
-                                pointSize,
+                                actualPointSize,
                                 mDpiHorizontal,
                                 mDpiVertical );
 
@@ -1229,17 +1242,17 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
                              static_cast< float >( ftFace->underline_position ) * FROM_266,
                              static_cast< float >( ftFace->underline_thickness ) * FROM_266 );
 
-        mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics ) );
+        mFontCache.push_back( CacheItem( ftFace, path, requestedPointSize, faceIndex, metrics ) );
         id = mFontCache.size();
 
         if( cacheDescription )
         {
-          CacheFontPath( ftFace, id, pointSize, path );
+          CacheFontPath( ftFace, id, requestedPointSize, path );
         }
       }
       else
       {
-        DALI_LOG_ERROR( "FreeType Set_Char_Size error: %d for pointSize %d\n", error, pointSize );
+        DALI_LOG_ERROR( "FreeType Set_Char_Size error: %d for pointSize %d\n", error, actualPointSize );
       }
     }
   }
@@ -1307,7 +1320,7 @@ void FontClient::Plugin::ConvertBitmap( BufferImage& destBitmap,
 }
 
 bool FontClient::Plugin::FindFont( const FontPath& path,
-                                   PointSize26Dot6 pointSize,
+                                   PointSize26Dot6 requestedPointSize,
                                    FaceIndex faceIndex,
                                    FontId& fontId ) const
 {
@@ -1319,7 +1332,7 @@ bool FontClient::Plugin::FindFont( const FontPath& path,
   {
     const CacheItem& cacheItem = *it;
 
-    if( cacheItem.mPointSize == pointSize &&
+    if( cacheItem.mRequestedPointSize == requestedPointSize &&
         cacheItem.mFaceIndex == faceIndex &&
         cacheItem.mPath == path )
     {
@@ -1397,7 +1410,7 @@ bool FontClient::Plugin::FindFallbackFontList( const FontDescription& fontDescri
 }
 
 bool FontClient::Plugin::FindFont( FontDescriptionId validatedFontId,
-                                   PointSize26Dot6 pointSize,
+                                   PointSize26Dot6 requestedPointSize,
                                    FontId& fontId )
 {
   fontId = 0u;
@@ -1410,7 +1423,7 @@ bool FontClient::Plugin::FindFont( FontDescriptionId validatedFontId,
     const FontIdCacheItem& item = *it;
 
     if( ( validatedFontId == item.validatedFontId ) &&
-        ( pointSize == item.pointSize ) )
+        ( requestedPointSize == item.requestedPointSize ) )
     {
       fontId = item.fontId;
       return true;
@@ -1520,7 +1533,7 @@ void FontClient::Plugin::GetFixedSizes( const FontDescription& fontDescription,
   FcPatternDestroy( fontFamilyPattern );
 }
 
-void FontClient::Plugin::CacheFontPath( FT_Face ftFace, FontId id, PointSize26Dot6 pointSize,  const FontPath& path )
+void FontClient::Plugin::CacheFontPath( FT_Face ftFace, FontId id, PointSize26Dot6 requestedPointSize,  const FontPath& path )
 {
   FontDescription description;
   description.path = path;
@@ -1555,9 +1568,9 @@ void FontClient::Plugin::CacheFontPath( FT_Face ftFace, FontId id, PointSize26Do
 
     mValidatedFontCache.push_back( item );
 
-    // Cache the pair 'validatedFontId, pointSize' to improve the following queries.
+    // Cache the pair 'validatedFontId, requestedPointSize' to improve the following queries.
     mFontIdCache.push_back( FontIdCacheItem( validatedFontId,
-                                             pointSize,
+                                             requestedPointSize,
                                              id ) );
   }
 }
index 9f997a2..517a265 100644 (file)
@@ -86,12 +86,12 @@ struct FontClient::Plugin
   struct FontIdCacheItem
   {
     FontIdCacheItem( FontDescriptionId validatedFontId,
-                     PointSize26Dot6 pointSize,
+                     PointSize26Dot6 requestedPointSize,
                      FontId fontId );
 
-    FontDescriptionId validatedFontId; ///< Index to the vector with font descriptions.
-    PointSize26Dot6   pointSize;       ///< The font point size.
-    FontId            fontId;          ///< The font id.
+    FontDescriptionId validatedFontId;    ///< Index to the vector with font descriptions.
+    PointSize26Dot6   requestedPointSize; ///< The font point size.
+    FontId            fontId;             ///< The font id.
   };
 
   /**
@@ -101,32 +101,32 @@ struct FontClient::Plugin
   {
     CacheItem( FT_Face ftFace,
                const FontPath& path,
-               PointSize26Dot6 pointSize,
+               PointSize26Dot6 requestedPointSize,
                FaceIndex face,
                const FontMetrics& metrics );
 
     CacheItem( FT_Face ftFace,
                const FontPath& path,
-               PointSize26Dot6 pointSize,
+               PointSize26Dot6 requestedPointSize,
                FaceIndex face,
                const FontMetrics& metrics,
                float fixedWidth,
                float fixedHeight );
 
-    FT_Face mFreeTypeFace;       ///< The FreeType face.
-    FontPath mPath;              ///< The path to the font file name.
-    PointSize26Dot6 mPointSize;  ///< The font point size.
-    FaceIndex mFaceIndex;        ///< The face index.
-    FontMetrics mMetrics;        ///< The font metrics.
-    FT_Short mFixedWidthPixels;  ///< The height in pixels (fixed size bitmaps only)
-    FT_Short mFixedHeightPixels; ///< The height in pixels (fixed size bitmaps only)
-    unsigned int mVectorFontId;  ///< The ID of the equivalent vector-based font
-    bool mIsFixedSizeBitmap;     ///< Whether the font has fixed size bitmaps.
+    FT_Face mFreeTypeFace;               ///< The FreeType face.
+    FontPath mPath;                      ///< The path to the font file name.
+    PointSize26Dot6 mRequestedPointSize; ///< The font point size.
+    FaceIndex mFaceIndex;                ///< The face index.
+    FontMetrics mMetrics;                ///< The font metrics.
+    FT_Short mFixedWidthPixels;          ///< The height in pixels (fixed size bitmaps only)
+    FT_Short mFixedHeightPixels;         ///< The height in pixels (fixed size bitmaps only)
+    unsigned int mVectorFontId;          ///< The ID of the equivalent vector-based font
+    bool mIsFixedSizeBitmap;             ///< Whether the font has fixed size bitmaps.
   };
 
   struct EllipsisItem
   {
-    PointSize26Dot6 size;
+    PointSize26Dot6 requestedPointSize;
     GlyphInfo glyph;
   };
 
@@ -193,31 +193,37 @@ struct FontClient::Plugin
    */
   FontId FindFontForCharacter( const FontList& fontList,
                                Character charcode,
-                               PointSize26Dot6 requestedSize,
+                               PointSize26Dot6 requestedPointSize,
                                bool preferColor );
 
   /**
    * @copydoc Dali::FontClient::FindDefaultFont()
    */
-  FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor );
+  FontId FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor );
 
   /**
    * @copydoc Dali::FontClient::FindFallbackFont()
    */
-  FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedSize, bool preferColor );
+  FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor );
 
   /**
-   * @see Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   * @see Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
    *
+   * @param[in] actualPointSize The actual point size. In case of emojis the @p requestedPointSize is used to build the metrics and cache the font and the @p actualPointSize is used to load the glyph.
    * @param[in] cacheDescription Whether to cache the font description.
    */
-  FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription = true );
+  FontId GetFontId( const FontPath& path,
+                    PointSize26Dot6 requestedPointSize,
+                    PointSize26Dot6 actualPointSize,
+                    FaceIndex faceIndex,
+                    bool cacheDescription = true );
 
   /**
-   * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
    */
   FontId GetFontId( const FontDescription& fontDescription,
-                    PointSize26Dot6 pointSize,
+                    PointSize26Dot6 requestedPointSize,
+                    PointSize26Dot6 actualPointSize,
                     FaceIndex faceIndex );
 
   /**
@@ -244,7 +250,7 @@ struct FontClient::Plugin
   /**
    * @copydoc Dali::FontClient::GetFontMetrics()
    */
-  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize );
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics );
 
   /**
    * @copydoc Dali::FontClient::GetGlyphIndex()
@@ -254,17 +260,17 @@ struct FontClient::Plugin
   /**
    * @copydoc Dali::FontClient::GetGlyphMetrics()
    */
-  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal, int desiredFixedSize );
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal );
 
   /**
    * Helper for GetGlyphMetrics when using bitmaps
    */
-  bool GetBitmapMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int desiredFixedSize );
+  bool GetBitmapMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
 
   /**
    * Helper for GetGlyphMetrics when using vectors
    */
-  bool GetVectorMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int desiredFixedSize );
+  bool GetVectorMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
 
   /**
    * @copydoc Dali::FontClient::CreateBitmap()
@@ -279,7 +285,7 @@ struct FontClient::Plugin
   /**
    * @copydoc Dali::FontClient::GetEllipsisGlyph()
    */
-  const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 pointSize );
+  const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 requestedPointSize );
 
 private:
 
@@ -340,25 +346,18 @@ private:
    * @brief Creates a font.
    *
    * @param[in] path The path to the font file name.
-   * @param[in] pointSize The font point size.
+   * @param[in] requestedPointSize The requested point size.
+   * @param[in] actualPointSize The actual point size (for color emojis).
    * @param[in] faceIndex A face index.
    * @param[in] cacheDescription Whether to cache the font description.
    *
    * @return The font id.
    */
-  FontId CreateFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription );
-
-  /**
-   * @brief Creates a fixed size font
-   *
-   * @param[in] path The path to the font file name.
-   * @param[in] pointSize The font point size( must be an available size ).
-   * @param[in] faceIndex A face index.
-   * @param[in] cacheDescription Whether to cache the font description.
-   *
-   * @return The font id.
-   */
-  FontId CreateFixedSizeFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription );
+  FontId CreateFont( const FontPath& path,
+                     PointSize26Dot6 requestedPointSize,
+                     PointSize26Dot6 actualPointSize,
+                     FaceIndex faceIndex,
+                     bool cacheDescription );
 
   /**
    *
@@ -372,13 +371,13 @@ private:
    * If there is one , if writes the font id in the param @p fontId.
    *
    * @param[in] path Path to the font file name.
-   * @param[in] pointSize The font point size.
+   * @param[in] requestedPointSize The font point size.
    * @param[in] faceIndex The face index.
    * @param[out] fontId The font id.
    *
    * @return @e true if there triplet is found.
    */
-  bool FindFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, FontId& fontId ) const;
+  bool FindFont( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex, FontId& fontId ) const;
 
   /**
    * @brief Finds in the cache a cluster 'font family, font width, font weight, font slant'
@@ -406,13 +405,13 @@ private:
    * If there is one it writes the font id in the param @p fontId.
    *
    * @param[in] validatedFontId Index to the vector with font descriptions.
-   * @param[in] pointSize The font point size.
+   * @param[in] requestedPointSize The font point size.
    * @param[out] fontId The font id.
    *
    * @return @e true if the pair is found.
    */
   bool FindFont( FontDescriptionId validatedFontId,
-                 PointSize26Dot6 pointSize,
+                 PointSize26Dot6 requestedPointSize,
                  FontId& fontId );
 
   /**
@@ -437,10 +436,10 @@ private:
    *
    * @param[in] ftFace The FreeType face.
    * @param[in] id The font identifier.
-   * @param[in] pointSize The font point size.
+   * @param[in] requestedPointSize The font point size.
    * @param[in] path Path to the font file name.
    */
-  void CacheFontPath( FT_Face ftFace, FontId id, PointSize26Dot6 pointSize,  const FontPath& path );
+  void CacheFontPath( FT_Face ftFace, FontId id, PointSize26Dot6 requestedPointSize,  const FontPath& path );
 
 private: