X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmulti-language-support-impl.h;h=cda767a99c3d184d865a4f1e47e8023baa725799;hp=c9a7d3022e018724c13f8001f210b256667e6e22;hb=fbd8d4da2506b57b46a71c5d113f4cb86f23c731;hpb=6679346de127fe5a504299789fb933e89fe2bb01 diff --git a/dali-toolkit/internal/text/multi-language-support-impl.h b/dali-toolkit/internal/text/multi-language-support-impl.h index c9a7d30..cda767a 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.h +++ b/dali-toolkit/internal/text/multi-language-support-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__ -#define __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__ +#ifndef DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H +#define DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,22 +26,18 @@ namespace Dali { - namespace TextAbstraction { //Forward declaration class FontClient; -} +} // namespace TextAbstraction namespace Toolkit { - namespace Text { - namespace Internal { - /** * @brief Stores valid font ids per script. */ @@ -52,13 +48,15 @@ struct ValidateFontsPerScript */ ValidateFontsPerScript() : mValidFonts() - {} + { + } /** * Default destructor. */ ~ValidateFontsPerScript() - {} + { + } /** * @brief Whether the given @p fontId is in the vector of valid fonts. @@ -67,7 +65,7 @@ struct ValidateFontsPerScript * * @return @e true if the font is in the vector of valid fonts. */ - bool IsValidFont( FontId fontId ) const; + bool IsValidFont(FontId fontId) const; Vector mValidFonts; }; @@ -80,7 +78,7 @@ struct DefaultFonts struct CacheItem { TextAbstraction::FontDescription description; - FontId fontId; + FontId fontId; }; /** @@ -88,13 +86,15 @@ struct DefaultFonts */ DefaultFonts() : mFonts() - {} + { + } /** * Default destructor. */ ~DefaultFonts() - {} + { + } /** * @brief Finds a default font for the given @p size. @@ -105,11 +105,11 @@ struct DefaultFonts * * @return The font id of a default font for the given @p size. If there isn't any font cached it returns 0. */ - FontId FindFont( TextAbstraction::FontClient& fontClient, - const TextAbstraction::FontDescription& description, - PointSize26Dot6 size ) const; + FontId FindFont(TextAbstraction::FontClient& fontClient, + const TextAbstraction::FontDescription& description, + PointSize26Dot6 size) const; - void Cache( const TextAbstraction::FontDescription& description, FontId fontId ); + void Cache(const TextAbstraction::FontDescription& description, FontId fontId); std::vector mFonts; }; @@ -120,7 +120,6 @@ struct DefaultFonts class MultilanguageSupport : public BaseObject { public: - /** * Constructor */ @@ -141,42 +140,64 @@ public: /** * @copydoc Dali::MultilanguageSupport::SetScripts() */ - void SetScripts( const Vector& text, - CharacterIndex startIndex, - Length numberOfCharacters, - Vector& scripts ); + void SetScripts(const Vector& text, + CharacterIndex startIndex, + Length numberOfCharacters, + Vector& scripts); /** * @copydoc Dali::MultilanguageSupport::ValidateFonts() */ - void ValidateFonts( const Vector& text, - const Vector& scripts, - const Vector& fontDescriptions, - const TextAbstraction::FontDescription& defaultFontDescription, - TextAbstraction::PointSize26Dot6 defaultFontPointSize, - CharacterIndex startIndex, - Length numberOfCharacters, - Vector& fonts ); + void ValidateFonts(const Vector& text, + const Vector& scripts, + const Vector& fontDescriptions, + const TextAbstraction::FontDescription& defaultFontDescription, + TextAbstraction::PointSize26Dot6 defaultFontPointSize, + CharacterIndex startIndex, + Length numberOfCharacters, + Vector& fonts); private: Vector mDefaultFontPerScriptCache; ///< Caches default fonts for a script. Vector mValidFontsPerScriptCache; ///< Caches valid fonts for a script. + + //Methods + + /** + * @brief Add the current script to scripts and create new script. + * + * @param[in] requestedScript The script of the new script run. + * @param[in] isRightToLeft The direction of the new script run. + * @param[in] addScriptCharactersToNewScript Whether to add the pending characters to the new script run or to the current script run. + * @param[inout] currentScriptRun The current character script run and it will be updated it to the new script run. + * @param[inout] numberOfAllScriptCharacters The pending characters. + * @param[inout] scripts The list of scripts. + * @param[inout] scriptIndex The current index of scripts. + * + */ + void AddCurrentScriptAndCreatNewScript(const Script requestedScript, + const bool isRightToLeft, + const bool addScriptCharactersToNewScript, + ScriptRun& currentScriptRun, + Length& numberOfAllScriptCharacters, + Vector& scripts, + ScriptRunIndex& scriptIndex); }; } // namespace Internal -inline static Internal::MultilanguageSupport& GetImplementation( MultilanguageSupport& multilanguageSupport ) +inline static Internal::MultilanguageSupport& GetImplementation(MultilanguageSupport& multilanguageSupport) { - DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" ); + DALI_ASSERT_ALWAYS(multilanguageSupport && "multi-language handle is empty"); BaseObject& handle = multilanguageSupport.GetBaseObject(); - return static_cast( handle ); + return static_cast(handle); } -inline static const Internal::MultilanguageSupport& GetImplementation( const MultilanguageSupport& multilanguageSupport ) +inline static const Internal::MultilanguageSupport& GetImplementation(const MultilanguageSupport& multilanguageSupport) { - DALI_ASSERT_ALWAYS( multilanguageSupport && "multi-language handle is empty" ); + DALI_ASSERT_ALWAYS(multilanguageSupport && "multi-language handle is empty"); const BaseObject& handle = multilanguageSupport.GetBaseObject(); - return static_cast( handle ); + return static_cast(handle); } } // namespace Text @@ -185,4 +206,4 @@ inline static const Internal::MultilanguageSupport& GetImplementation( const Mul } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H__ +#endif // DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_IMPL_H