1 #ifndef __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__
2 #define __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/base-object.h>
25 #include <dali-toolkit/internal/text/multi-language-support.h>
40 * @brief Stores valid font ids per script.
42 struct ValidateFontsPerScript
45 * Default constructor.
47 ValidateFontsPerScript()
54 ~ValidateFontsPerScript()
58 * @brief Whether the given @p fontId is in the vector of valid fonts.
60 * @param[in] fontId The font id.
62 * @return @e true if the font is in the vector of valid fonts.
64 bool FindValidFont( FontId fontId ) const;
66 Vector<FontId> mValidFonts;
70 * @brief Multi-language support implementation. @see Text::MultilanguageSupport.
72 class MultilanguageSupport : public BaseObject
79 MultilanguageSupport();
84 * This is non-virtual since derived Handle types must not contain data or virtual methods.
86 ~MultilanguageSupport();
89 * @copydoc Dali::MultilanguageSupport::Get()
91 static Text::MultilanguageSupport Get();
94 * @copydoc Dali::MultilanguageSupport::SetScripts()
96 void SetScripts( const Vector<Character>& text,
97 Vector<ScriptRun>& scripts );
100 * @copydoc Dali::MultilanguageSupport::ValidateFonts( const Vector<Character>& text, const Vector<ScriptRun>& scripts, Vector<FontRun>& fonts )
102 void ValidateFonts( const Vector<Character>& text,
103 const Vector<ScriptRun>& scripts,
104 Vector<FontRun>& fonts );
107 Vector<FontId> mDefaultFontPerScriptCache; ///< Caches the default font for a script.
108 Vector<ValidateFontsPerScript*> mValidFontsPerScriptCache; ///< Caches valid fonts for a script.
111 } // namespace Internal
113 inline static Internal::MultilanguageSupport& GetImplementation( MultilanguageSupport& multilanguageSupport )
115 DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" );
116 BaseObject& handle = multilanguageSupport.GetBaseObject();
117 return static_cast<Internal::MultilanguageSupport&>( handle );
120 inline static const Internal::MultilanguageSupport& GetImplementation( const MultilanguageSupport& multilanguageSupport )
122 DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" );
123 const BaseObject& handle = multilanguageSupport.GetBaseObject();
124 return static_cast<const Internal::MultilanguageSupport&>( handle );
129 } // namespace Toolkit
133 #endif // __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__