#endif
const Dali::Toolkit::Text::Character UTF32_A = 0x0041;
+
}
namespace Text
MultilanguageSupport::MultilanguageSupport()
: mDefaultFontPerScriptCache(),
- mValidFontsPerScriptCache()
+ mValidFontsPerScriptCache(),
+ mSlotDelegate( this )
{
// Initializes the default font cache to zero (invalid font).
// Reserves space to cache the default fonts and access them with the script as an index.
}
}
+ // Connect LanguageChangedSignal to clear caches when locale is changed.
+ Dali::Adaptor::Get().LanguageChangedSignal().Connect( mSlotDelegate, &Dali::Toolkit::Text::Internal::MultilanguageSupport::OnLanguageChanged );
+}
+
+void MultilanguageSupport::OnLanguageChanged( Dali::Adaptor& adaptor )
+{
+ // When locale is changed, font configuration might provide a different font list.
+ // In this case, the original cached font might not be valid for same script.
+ // Therefore, we need to clear caches.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.ClearCache();
+
+ mDefaultFontPerScriptCache.Clear();
+ mValidFontsPerScriptCache.Clear();
+ mDefaultFontPerScriptCache.Resize( TextAbstraction::UNKNOWN + 1, NULL );
+ mValidFontsPerScriptCache.Resize( TextAbstraction::UNKNOWN + 1, NULL );
}
MultilanguageSupport::~MultilanguageSupport()
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/multi-language-support.h>
+#include <dali/integration-api/adaptors/adaptor.h>
namespace Dali
{
*/
~MultilanguageSupport();
+
+ /**
+ * Dali::MultilanguageSupport::OnLanguageChanged()
+ *
+ * Get notice when system language is changed.
+ */
+ void OnLanguageChanged( Dali::Adaptor& adaptor );
+
/**
* @copydoc Dali::MultilanguageSupport::Get()
*/
Vector<FontRun>& fonts );
private:
- Vector<DefaultFonts*> mDefaultFontPerScriptCache; ///< Caches default fonts for a script.
- Vector<ValidateFontsPerScript*> mValidFontsPerScriptCache; ///< Caches valid fonts for a script.
+ Vector<DefaultFonts*> mDefaultFontPerScriptCache; ///< Caches default fonts for a script.
+ Vector<ValidateFontsPerScript*> mValidFontsPerScriptCache; ///< Caches valid fonts for a script.
+ SlotDelegate< MultilanguageSupport > mSlotDelegate; //< SlotDelegate to listen LanguageChangedSignal.
};
} // namespace Internal