X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Ftext%2Ftext-abstraction%2Ffont-client-impl.h;h=ff86fd960e1087b811a38a3b92f2987357f73bec;hb=d676584a4cb6eef8410fd1d7f23fc838ac398f99;hp=ffa070ac38921d98c362a161259f650f6d2bcc5c;hpb=28cd5d6531f580e41ba3ff6d1e3cb5bdccc13c24;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/text/text-abstraction/font-client-impl.h b/dali/internal/text/text-abstraction/font-client-impl.h index ffa070a..ff86fd9 100644 --- a/dali/internal/text/text-abstraction/font-client-impl.h +++ b/dali/internal/text/text-abstraction/font-client-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -32,6 +32,8 @@ namespace TextAbstraction { namespace Internal { +using HarfBuzzFontHandle = void*; ///< @note We don't want to make other class include harfbuzz header. So we will keep harfbuzz font data as HarfBuzzFontHandle. + /** * Implementation of the FontClient */ @@ -48,6 +50,7 @@ public: */ ~FontClient(); +public: // API for Dali::TextAbstraction::FontClient used. /** * @copydoc Dali::TextAbstraction::FontClient::Get() */ @@ -61,11 +64,45 @@ public: static Dali::TextAbstraction::FontClient PreInitialize(); /** + * @brief This is used to pre-cache FontConfig in order to improve the runtime performance of the application. + * + * @see Dali::TextAbstraction::FontClientPreCache(const FontFamilyList& fallbackFamilyList, const FontFamilyList& extraFamilyList, const FontFamily& localeFamily, bool useThread, bool syncCreation); + */ + static void PreCache(const FontFamilyList& fallbackFamilyList, const FontFamilyList& extraFamilyList, const FontFamily& localeFamily, bool useThread, bool syncCreation); + + /** + * @brief This is used to creates a global font client and pre-caches the FontConfig. + */ + static void PreCacheRun(const FontFamilyList& fallbackFamilyList, const FontFamilyList& extraFamilyList, const FontFamily& localeFamily, bool syncCreation); + + /** + * @brief This is used to pre-load FreeType font face in order to improve the runtime performance of the application. + * + * @see Dali::TextAbstraction:FontClientFontPreLoad(const FontPathList& fontPathList, const FontPathList& memoryFontPathList, bool useThread, bool syncCreation); + */ + static void PreLoad(const FontPathList& fontPathList, const FontPathList& memoryFontPathList, bool useThread, bool syncCreation); + + /** + * @brief This is used to creates a global font client and pre-loads the FreeType font face. + */ + static void PreLoadRun(const FontPathList& fontPathList, const FontPathList& memoryFontPathList, bool syncCreation); + + /** + * @brief Joins font threads, waiting for their execution to complete. + */ + static void JoinFontThreads(); + + /** * @copydoc Dali::TextAbstraction::FontClient::ClearCache() */ void ClearCache(); /** + * @copydoc Dali::TextAbstraction::FontClient::ClearCacheOnLocaleChanged() + */ + void ClearCacheOnLocaleChanged(); + + /** * @copydoc Dali::TextAbstraction::FontClient::SetDpi() */ void SetDpi(unsigned int horizontalDpi, unsigned int verticalDpi); @@ -91,6 +128,11 @@ public: void GetDefaultFonts(FontList& defaultFonts); /** + * @copydoc Dali::TextAbstraction::FontClient::InitDefaultFontDescription() + */ + void InitDefaultFontDescription(); + + /** * @copydoc Dali::TextAbstraction::FontClient::GetDefaultPlatformFontDescription() */ void GetDefaultPlatformFontDescription(FontDescription& fontDescription); @@ -103,12 +145,12 @@ public: /** * @copydoc Dali::TextAbstraction::FontClient::GetDescription() */ - void GetDescription(FontId id, FontDescription& fontDescription); + void GetDescription(FontId fontId, FontDescription& fontDescription); /** * @copydoc Dali::TextAbstraction::FontClient::GetPointSize() */ - PointSize26Dot6 GetPointSize(FontId id); + PointSize26Dot6 GetPointSize(FontId fontId); /** * @copydoc Dali::TextAbstraction::FontClient::IsCharacterSupportedByFont() @@ -194,9 +236,9 @@ public: bool GetGlyphMetrics(GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal); /** - * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool isItalicRequired, bool isBoldRequired, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth ) + * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool isItalicRequired, bool isBoldRequired, Dali::TextAbstraction::GlyphBufferData& data, int outlineWidth ) */ - void CreateBitmap(FontId fontId, GlyphIndex glyphIndex, bool isItalicRequired, bool isBoldRequired, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth); + void CreateBitmap(FontId fontId, GlyphIndex glyphIndex, bool isItalicRequired, bool isBoldRequired, Dali::TextAbstraction::GlyphBufferData& data, int outlineWidth); /** * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth ) @@ -259,6 +301,12 @@ public: uint32_t GetNumberOfPointsPerOneUnitOfPointSize() const; /** + * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory() + */ + bool AddCustomFontDirectory(const FontPath& path); + +public: // API for Dali::TextAbstraction::Internal::FontClient used. + /** * @brief Retrieves the pointer to the FreeType Font Face for the given @p fontId. * * @param[in] fontId The font id. @@ -277,9 +325,31 @@ public: FontDescription::Type GetFontType(FontId fontId); /** - * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory() + * @brief Get the harfbuzz font data of font. + * + * @param fontId The font id. + * @return The harfbuzz font data, or nullptr if failed. */ - bool AddCustomFontDirectory(const FontPath& path); + HarfBuzzFontHandle GetHarfBuzzFont(FontId fontId); + + /** + * @brief This is used to pre-cache fonts in order to improve the runtime performance of the application. + * + * @param[in] fallbackFamilyList A list of fallback font families to be pre-cached. + * @param[in] extraFamilyList A list of additional font families to be pre-cached. + * @param[in] localeFamily A locale font family to be pre-cached. + */ + void FontPreCache(const FontFamilyList& fallbackFamilyList, const FontFamilyList& extraFamilyList, const FontFamily& localeFamily); + + /** + * @brief This is used to pre-load FreeType font face in order to improve the runtime performance of the application. + * + * @param[in] fontPathList A list of font paths to be pre-loaded. + * @param[in] memoryFontPathList A list of memory font paths to be pre-loaded. + * @param[in] useThread True if the font client should create thread and perform font pre-loading, false otherwise. + */ + void FontPreLoad(const FontPathList& fontPathList, const FontPathList& memoryFontPathList); + private: /** @@ -301,7 +371,7 @@ private: unsigned int mDpiHorizontal; unsigned int mDpiVertical; - static Dali::TextAbstraction::FontClient gPreInitializedFontClient; + static Dali::TextAbstraction::FontClient gPreCreatedFontClient; }; // class FontClient