Add CreateFontN(FontMaxHeight)
[platform/framework/native/uifw.git] / src / graphics / FGrp_FontFt2.cpp
index 6ca3c5f..179a286 100644 (file)
@@ -1056,6 +1056,24 @@ _FontFt2::GetGlyphList(const _Util::String& reorderedText, Tizen::Base::Collecti
        return true;
 }
 
+float
+_FontFt2::GetFontSizeFromMaxHeight(_Util::FixedPoint26_6 expectedMaxHeight) const
+{
+       FT_Face pFace = (FT_Face) __pFontFace;
+
+       if (pFace == null)
+       {
+               return -1.0f;
+       }
+
+       int verticalResolution = 1;
+
+       _Util::FixedPoint26_6 fontSize;
+       fontSize.Reset(pFace->units_per_EM * expectedMaxHeight / (pFace->height * verticalResolution) - (1 / (2 * verticalResolution)));
+
+       return fontSize.ToFloat();
+}
+
 void
 _FontFt2::__CleanUp()
 {