Call GetfallbackFont when Systemfontchanged
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Wed, 17 Apr 2013 10:05:24 +0000 (19:05 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Wed, 17 Apr 2013 10:05:24 +0000 (19:05 +0900)
Change-Id: I361e6592437ea9baded0e750334ba42cae64786d
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
src/ui/FUi_Control.cpp
src/ui/FUi_ControlManager.cpp
src/ui/controls/FUiCtrl_LabelPresenter.cpp
src/ui/inc/FUi_ControlManager.h

index a900e51..ae72983 100644 (file)
@@ -2565,7 +2565,7 @@ _Control::GetFallbackFont(void)
        delegate.OnFontInfoRequested(style, floatTextSize);\r
        _ControlManager* pControlManager = _ControlManager::GetInstance();\r
        _FontImpl* pFontImpl  = _FontImpl::GetInstance(*__pFont);\r
-       if (!(__isControlFontChanged || pControlManager->IsDefaultFontChanged())\r
+       if (!(__isControlFontChanged || pControlManager->IsDefaultFontChanged() || pControlManager->IsSystemFontChanged())\r
                && __pFont != null\r
                && ((__pFont->GetSize() == textSize || __pFont->GetSizeF() == floatTextSize))\r
                && (pFontImpl->GetStyle() == static_cast<int>(style)))\r
index 41dcef7..d73de96 100755 (executable)
@@ -313,6 +313,7 @@ _ControlManager::_ControlManager(void) // [ToDo] exception check.
        , __gestureMaxDuration(0)
        , __touchedWindow(0)
        , __isDefaultFontChanged(false)
+       , __isSystemFontChanged(false)
        , __defaultFontName(L"")
        , __screenDpi(0)
        , __pClipboardOwner(null)
@@ -1464,11 +1465,17 @@ _ControlManager::GetDefaultFontFile(void) const
        return __defaultFontFileName;
 }
 bool
-_ControlManager::IsDefaultFontChanged(void)
+_ControlManager::IsDefaultFontChanged(void) const
 {
        return __isDefaultFontChanged;
 }
 
+bool
+_ControlManager::IsSystemFontChanged(void) const
+{
+       return __isSystemFontChanged;
+}
+
 void
 _ControlManager::SetDefaultFontChangeState(bool isDefaultFontChanged)
 {
@@ -1562,9 +1569,29 @@ _ControlManager::OnSettingChanged(Tizen::Base::String& key)
          if (key == FONT_TYPE || key == LOCALE_COUNTRY || key == LOCALE_LANGUAGE)
        {
                _FontImpl::UpdateDefaultFont(key);
+               __isSystemFontChanged = true;
+               struct _Visitor
+               : public _Control::Visitor
+               {
+                        virtual _Control::VisitType Visit(_Control& control)
+                       {
+                               control.GetFallbackFont();
+                               _IControlDelegate& delegate = control.GetControlDelegate();
+                               delegate.OnFontChanged(control.__pFont);
+                               return _Control::VISIT_DOWNWARD;
+                       }
+               };
+
+               _Visitor visitor;
 
                int count = GetWindowCount();
+               for (int j = 0; j < count; j++)
+               {
+                       _Window* pWindow = GetWindow((count-1) - j);
+                       pWindow->Accept(visitor);
+               }
 
+               __isSystemFontChanged = false;
                for(int index = 0; index < count ; index++)
                {
                        _Window* pWindow = GetWindow(index);
index 32c0991..d7c044b 100644 (file)
@@ -148,7 +148,10 @@ void
 _LabelPresenter::OnFontChanged(Font* pFont)
 {
        __pFont = pFont;
-
+       if (__pTextObject)
+       {
+               __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
+       }
        return;
 }
 
@@ -390,7 +393,6 @@ _LabelPresenter::DrawText(void)
        }
 
        __pTextObject->SetAlignment(horizontalAlign | verticalAlign);
-       __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
        __pTextObject->Compose();
        __pTextObject->SetForegroundColor(__pLabel->GetTextColor(), 0, __pTextObject->GetTextLength());
        __pTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
index 692b2b1..69b06d3 100644 (file)
@@ -88,7 +88,8 @@ public:
 // Font
        result SetDefaultFont(const Tizen::Base::String& appFontName);
        Tizen::Base::String GetDefaultFont(void);
-       bool IsDefaultFontChanged(void);
+       bool IsDefaultFontChanged(void) const;
+       bool IsSystemFontChanged(void) const;
        void SetDefaultFontChangeState(bool isDefaultFontChanged);
        result SetDefaultFontFromFile(const Tizen::Base::String& fileName);
        Tizen::Base::String GetDefaultFontFile(void) const;
@@ -170,7 +171,8 @@ private:
        Tizen::Base::Collection::IListT<_TouchGestureDetector*>* __pGestureList;
        int __gestureMaxDuration;
        unsigned int __touchedWindow;
-    bool __isDefaultFontChanged;
+       bool __isDefaultFontChanged;
+       bool __isSystemFontChanged;
        Tizen::Base::String __defaultFontName;
        Tizen::Base::String __defaultFontFileName;
        static _ControlManager* __pInstance;