Add CreateFontN(FontMaxHeight)
[platform/framework/native/uifw.git] / src / graphics / FGrp_Font.cpp
index 16f3ca3..49315bb 100644 (file)
@@ -2228,6 +2228,40 @@ _Font::CheckGlyph(unsigned long character)
        return __pNativeFont->CheckGlyph(character);
 }
 
+float
+_Font::GetFontSizeFromMaxHeight(const _Util::FixedPoint26_6 expectedMaxHeight)
+{
+       return __pNativeFont->GetFontSizeFromMaxHeight(expectedMaxHeight);
+}
+
+float
+_Font::GetFontSizeFromMaxHeight(int style, const _Util::FixedPoint26_6 expectedMaxHeight)
+{
+       _FontRsrcManager& mgr = _FontRsrcManager::GetInstance();
+       _FontRsrcManager::SharedFontResource out;
+
+       result r = mgr.GetFont(style, expectedMaxHeight, out);
+       SysTryReturn(NID_GRP, r == E_SUCCESS, -1.0f, r, "[%s] Getting system default font failed.", GetErrorMessage(r));
+
+       _IFont* pTempFont = out.get();
+
+       return pTempFont->GetFontSizeFromMaxHeight(expectedMaxHeight);
+}
+
+float
+_Font::GetFontSizeFromMaxHeight(const Tizen::Base::String& fontName, int style, const _Util::FixedPoint26_6 expectedMaxHeight)
+{
+       _FontRsrcManager& mgr = _FontRsrcManager::GetInstance();
+       _FontRsrcManager::SharedFontResource out;
+
+       result r = mgr.GetFont(fontName, style, expectedMaxHeight, out);
+       SysTryReturn(NID_GRP, r == E_SUCCESS, -1.0f, r, "[%s] Getting font failed.", GetErrorMessage(r));
+
+       _IFont* pTempFont = out.get();
+
+       return pTempFont->GetFontSizeFromMaxHeight(expectedMaxHeight);
+}
+
 void
 _Font::__UpdateFontAttribute(int style, _Util::FixedPoint26_6 pcSize)
 {