[Tizen] Move glyph cache manager into font-client-plugin-cache-handler
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / plugin / font-face-cache-item.h
index e1e0c6e..10608d7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef DALI_TEST_ABSTRACTION_INTERNAL_FONT_FACE_CACHE_ITEM_H
-#define DALI_TEST_ABSTRACTION_INTERNAL_FONT_FACE_CACHE_ITEM_H
+#ifndef DALI_TEXT_ABSTRACTION_INTERNAL_FONT_FACE_CACHE_ITEM_H
+#define DALI_TEXT_ABSTRACTION_INTERNAL_FONT_FACE_CACHE_ITEM_H
 
 /*
  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
 // INTERNAL INCLUDES
 #include <dali/internal/text/text-abstraction/plugin/font-cache-item-interface.h>
 #include <dali/internal/text/text-abstraction/plugin/font-face-glyph-cache-manager.h>
+#include <dali/internal/text/text-abstraction/plugin/harfbuzz-proxy-font.h>
 
 // EXTERNAL INCLUDES
 #include <fontconfig/fontconfig.h>
+#include <memory> // for std::unique_ptr
 
 // EXTERNAL INCLUDES
 #include <ft2build.h>
@@ -39,15 +41,17 @@ namespace Dali::TextAbstraction::Internal
  */
 struct FontFaceCacheItem : public FontCacheItemInterface
 {
-  FontFaceCacheItem(FT_Library&        freeTypeLibrary,
+  FontFaceCacheItem(const FT_Library&  freeTypeLibrary,
                     FT_Face            ftFace,
+                    GlyphCacheManager* glyphCacheManager,
                     const FontPath&    path,
                     PointSize26Dot6    requestedPointSize,
                     FaceIndex          face,
                     const FontMetrics& metrics);
 
-  FontFaceCacheItem(FT_Library&        freeTypeLibrary,
+  FontFaceCacheItem(const FT_Library&  freeTypeLibrary,
                     FT_Face            ftFace,
+                    GlyphCacheManager* glyphCacheManager,
                     const FontPath&    path,
                     PointSize26Dot6    requestedPointSize,
                     FaceIndex          face,
@@ -114,6 +118,11 @@ struct FontFaceCacheItem : public FontCacheItemInterface
   }
 
   /**
+   * @copydoc FontCacheItemInterface::GetHarfBuzzFont()
+   */
+  HarfBuzzFontHandle GetHarfBuzzFont(const uint32_t& horizontalDpi, const uint32_t& verticalDpi) override;
+
+  /**
    * @copydoc FontCacheItemInterface::HasItalicStyle()
    */
   bool HasItalicStyle() const override
@@ -121,23 +130,27 @@ struct FontFaceCacheItem : public FontCacheItemInterface
     return (0u != (mFreeTypeFace->style_flags & FT_STYLE_FLAG_ITALIC));
   }
 
-  FT_Library&        mFreeTypeLibrary;       ///< A handle to a FreeType library instance.
-  FT_Face            mFreeTypeFace;          ///< The FreeType face.
-  GlyphCacheManager* mGlyphCacheManager;     ///< The glyph cache manager. It will cache this face's glyphs.
-  FontPath           mPath;                  ///< The path to the font file name.
-  PointSize26Dot6    mRequestedPointSize;    ///< The font point size.
-  FaceIndex          mFaceIndex;             ///< The face index.
-  FontMetrics        mMetrics;               ///< The font metrics.
-  _FcCharSet*        mCharacterSet;          ///< Pointer with the range of characters.
-  int                mFixedSizeIndex;        ///< Index to the fixed size table for the requested size.
-  float              mFixedWidthPixels;      ///< The height in pixels (fixed size bitmaps only)
-  float              mFixedHeightPixels;     ///< The height in pixels (fixed size bitmaps only)
-  unsigned int       mVectorFontId;          ///< The ID of the equivalent vector-based font
-  FontId             mFontId;                ///< Index to the vector with the cache of font's ids.
-  bool               mIsFixedSizeBitmap : 1; ///< Whether the font has fixed size bitmaps.
-  bool               mHasColorTables : 1;    ///< Whether the font has color tables.
+public:
+  const FT_Library& mFreeTypeLibrary; ///< A handle to a FreeType library instance.
+  FT_Face           mFreeTypeFace;    ///< The FreeType face.
+
+  GlyphCacheManager*                 mGlyphCacheManager; ///< The reference of Glyph cache manager. Owned from font-client-plugin-cache-handler.
+  std::unique_ptr<HarfBuzzProxyFont> mHarfBuzzProxyFont; ///< The harfbuzz font. It will store harfbuzz relate data.
+
+  FontPath        mPath;                  ///< The path to the font file name.
+  PointSize26Dot6 mRequestedPointSize;    ///< The font point size.
+  FaceIndex       mFaceIndex;             ///< The face index.
+  FontMetrics     mMetrics;               ///< The font metrics.
+  _FcCharSet*     mCharacterSet;          ///< Pointer with the range of characters.
+  int             mFixedSizeIndex;        ///< Index to the fixed size table for the requested size.
+  float           mFixedWidthPixels;      ///< The height in pixels (fixed size bitmaps only)
+  float           mFixedHeightPixels;     ///< The height in pixels (fixed size bitmaps only)
+  unsigned int    mVectorFontId;          ///< The ID of the equivalent vector-based font
+  FontId          mFontId;                ///< Index to the vector with the cache of font's ids.
+  bool            mIsFixedSizeBitmap : 1; ///< Whether the font has fixed size bitmaps.
+  bool            mHasColorTables : 1;    ///< Whether the font has color tables.
 };
 
 } // namespace Dali::TextAbstraction::Internal
 
-#endif //DALI_TEST_ABSTRACTION_INTERNAL_FONT_FACE_CACHE_ITEM_H
+#endif //DALI_TEXT_ABSTRACTION_INTERNAL_FONT_FACE_CACHE_ITEM_H