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=afbeb232cf30a8b09f4469bab8fff0a251a4e047;hp=65933b53c555b4d9e5033bf9c8a4656451d98b38;hb=deca4cf3f3125804f83d352a077aa08c6ff95728;hpb=6516c90c9e264cf0a682aff36cb9bc5f1964b3e2 diff --git a/dali-toolkit/internal/text/multi-language-support-impl.h b/dali-toolkit/internal/text/multi-language-support-impl.h index 65933b5..afbeb23 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.h +++ b/dali-toolkit/internal/text/multi-language-support-impl.h @@ -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,33 +142,24 @@ public: * @copydoc Dali::MultilanguageSupport::SetScripts() */ void SetScripts( const Vector& text, - const Vector& lineBreakInfo, + CharacterIndex startIndex, + Length numberOfCharacters, Vector& scripts ); /** - * @copydoc Dali::MultilanguageSupport::ReplaceScripts() - */ - void ReplaceScripts( LogicalModel& model, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ); - - /** - * @copydoc Dali::MultilanguageSupport::ValidateFonts( const Vector& text, const Vector& scripts, Vector& fonts ) + * @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 ); - /** - * @copydoc Dali::MultilanguageSupport::ValidateFonts( LogicalModel& model, CharacterIndex characterIndex, Length numberOfCharactersToRemove, Length numberOfCharactersToInsert ) - */ - void ValidateFonts( LogicalModel& model, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ); 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. };