[Tizen] Fix emoji vertical alignment issue
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / plugin / font-client-plugin-impl.cpp
index e438a53..5668718 100644 (file)
@@ -1000,6 +1000,19 @@ GlyphIndex FontClient::Plugin::GetGlyphIndex(FontId    fontId,
   return 0u;
 }
 
+GlyphIndex FontClient::Plugin::GetGlyphIndex(FontId    fontId,
+                                             Character charcode,
+                                             Character variantSelector)
+{
+  const FontCacheItemInterface* fontCacheItem = GetCachedFontItem(fontId);
+  if(fontCacheItem != nullptr)
+  {
+    return fontCacheItem->GetGlyphIndex(charcode, variantSelector);
+  }
+
+  return 0u;
+}
+
 bool FontClient::Plugin::GetGlyphMetrics(GlyphInfo* array,
                                          uint32_t   size,
                                          GlyphType  type,
@@ -1554,16 +1567,17 @@ FontId FontClient::Plugin::CreateFont(const FontPath& path,
       }
       else
       {
+        FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
+
+        FontMetrics metrics(static_cast<float>(ftMetrics.ascender) * FROM_266,
+                            static_cast<float>(ftMetrics.descender) * FROM_266,
+                            static_cast<float>(ftMetrics.height) * FROM_266,
+                            static_cast<float>(ftFace->underline_position) * FROM_266,
+                            static_cast<float>(ftFace->underline_thickness) * FROM_266);
+
         const float fixedWidth  = static_cast<float>(ftFace->available_sizes[fixedSizeIndex].width);
         const float fixedHeight = static_cast<float>(ftFace->available_sizes[fixedSizeIndex].height);
 
-        // Indicate that the font is a fixed sized bitmap
-        FontMetrics metrics(fixedHeight, // The ascender in pixels.
-                            0.0f,
-                            fixedHeight, // The height in pixels.
-                            0.0f,
-                            0.0f);
-
         // Create the FreeType font face item to cache.
         FontFaceCacheItem fontFaceCacheItem(mFreeTypeLibrary, ftFace, path, requestedPointSize, faceIndex, metrics, fixedSizeIndex, fixedWidth, fixedHeight, hasColorTables);