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=cc6c985721d404f5c5c6712c2498d323209ebd12;hp=a424cd0fbfd63bc76705facdb341da55f33ee203;hb=b694e7e2ae624e206e1548b1a863c554eb9cd4d7;hpb=2dd044328238768ae8b27a223cb7d0f5cda53513 diff --git a/dali-toolkit/internal/text/multi-language-support-impl.h b/dali-toolkit/internal/text/multi-language-support-impl.h index a424cd0..cc6c985 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) 2019 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. @@ -18,15 +18,21 @@ * */ -// INTERNAL INCLUDES -#include - // EXTERNAL INCLUDES #include +// INTERNAL INCLUDES +#include + namespace Dali { +namespace TextAbstraction +{ +//Forward declaration +class FontClient; +} + namespace Toolkit { @@ -61,12 +67,54 @@ struct ValidateFontsPerScript * * @return @e true if the font is in the vector of valid fonts. */ - bool FindValidFont( FontId fontId ) const; + bool IsValidFont( FontId fontId ) const; Vector mValidFonts; }; /** + * @brief Stores default font ids per script. It can be different sizes for a default font family. + */ +struct DefaultFonts +{ + struct CacheItem + { + TextAbstraction::FontDescription description; + FontId fontId; + }; + + /** + * Default constructor. + */ + DefaultFonts() + : mFonts() + {} + + /** + * Default destructor. + */ + ~DefaultFonts() + {} + + /** + * @brief Finds a default font for the given @p size. + * + * @param[in] fontClient The font client. + * @param[in] description The font's description. + * @param[in] size The given size. + * + * @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; + + void Cache( const TextAbstraction::FontDescription& description, FontId fontId ); + + std::vector mFonts; +}; + +/** * @brief Multi-language support implementation. @see Text::MultilanguageSupport. */ class MultilanguageSupport : public BaseObject @@ -94,16 +142,24 @@ public: * @copydoc Dali::MultilanguageSupport::SetScripts() */ 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 ); private: - Vector mDefaultFontPerScriptCache; ///< Caches the default font for a script. + Vector mDefaultFontPerScriptCache; ///< Caches default fonts for a script. Vector mValidFontsPerScriptCache; ///< Caches valid fonts for a script. }; @@ -129,4 +185,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