Move glyph cache manager into font-client-plugin-cache-handler
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / plugin / harfbuzz-proxy-font.h
1 #ifndef DALI_TEXT_ABSTRACTION_INTERNAL_HARFBUZZ_PROXY_FONT_H
2 #define DALI_TEXT_ABSTRACTION_INTERNAL_HARFBUZZ_PROXY_FONT_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 // INTERNAL INCLUDES
21 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
22 #include <dali/internal/text/text-abstraction/font-client-impl.h> // for HarfBuzzFontHandle
23 #include <dali/internal/text/text-abstraction/plugin/font-face-glyph-cache-manager.h>
24
25 // EXTERNAL INCLUDES
26 #include <ft2build.h>
27 #include FT_FREETYPE_H
28
29 namespace Dali::TextAbstraction::Internal
30 {
31 /**
32  * @brief Helper class to shape of FT_Face by harfbuzz library.
33  * @note Current class only be used for font face cache item.
34  */
35 class HarfBuzzProxyFont
36 {
37 public:
38   /**
39    * @brief Constructor harfbuzz font data integrated with FreeType face and our font face cache item.
40    *
41    * @param[in] freeTypeFace The FreeType face.
42    * @param[in] requestedPointSize The requiested point size of font.
43    * @param[in] horizontalDpi Horizontal DPI.
44    * @param[in] verticalDpi Vertical DPI.
45    * @param[in] glyphCacheManager Glyph caching system for this harfbuzz font. It will be used as harfbuzz callback data.
46    */
47   HarfBuzzProxyFont(FT_Face freeTypeFace, const PointSize26Dot6& requestedPointSize, const uint32_t& horizontalDpi, const uint32_t& verticalDpi, GlyphCacheManager* glyphCacheManager);
48
49   // Destructor
50   ~HarfBuzzProxyFont();
51
52 public:
53   // Public API area.
54
55   /**
56    * @brief Get the created harfbuzz font data integrated with FreeType face and our font face cache item.
57    *
58    * @return Created harfbuzz font data. or nullptr if there is something error.
59    */
60   HarfBuzzFontHandle GetHarfBuzzFont() const;
61
62 private:
63   // Private API area.
64   HarfBuzzProxyFont()                             = delete; // Do not use default construct
65   HarfBuzzProxyFont(const HarfBuzzProxyFont& rhs) = delete; // Do not use copy construct
66   HarfBuzzProxyFont(HarfBuzzProxyFont&& rhs)      = delete; // Do not use move construct
67 public:
68   struct Impl;             // Harfbuzz callback can access this struct.
69   uint32_t mHorizontalDpi; ///< Horizontal DPI.
70   uint32_t mVerticalDpi;   ///< VerticalDPI.
71
72 private:
73   // Private member value area.
74   Impl* mImpl;
75 };
76
77 } // namespace Dali::TextAbstraction::Internal
78
79 #endif //DALI_TEXT_ABSTRACTION_INTERNAL_HARFBUZZ_PROXY_FONT_H