[dali_2.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / plugin / font-cache-item-interface.h
1 #ifndef DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_H
2 #define DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_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/font-client.h>
22 #include <dali/devel-api/text-abstraction/font-metrics.h>
23 #include <dali/devel-api/text-abstraction/glyph-info.h>
24 #include <dali/internal/text/text-abstraction/font-client-impl.h> // for HarfBuzzFontHandle
25
26 // EXTERNAL INCLUDES
27 #include <ft2build.h>
28 #include FT_FREETYPE_H
29
30 namespace Dali::TextAbstraction::Internal
31 {
32 struct FontCacheItemInterface
33 {
34   /**
35    * Get the font metrics
36    *
37    * @param[out] metrics The metrics struct to fill out
38    */
39   virtual void GetFontMetrics(FontMetrics& metrics, unsigned int dpiVertical) const = 0;
40
41   /**
42    * Get glyph metrics
43    *
44    * @param[in,out] glyph The glyph to fill
45    */
46   virtual bool GetGlyphMetrics(GlyphInfo& glyphInfo, unsigned int dpiVertical, bool horizontal) const = 0;
47
48   /**
49    * Create a bitmap for the given glyph
50    *
51    * @param[in] glyphIndex The index of the glyph
52    * @param[out] data The bitmap data for the glyph
53    * @param[in] outlineWidth
54    * @param[in] isItalicRequired
55    * @param[in] isBoldRequired
56    */
57   virtual void CreateBitmap(GlyphIndex glyphIndex, Dali::TextAbstraction::GlyphBufferData& data, int outlineWidth, bool isItalicRequired, bool isBoldRequired) const = 0;
58
59   /**
60    * Return true if the glyph is colored
61    *
62    * @param[in] glyphIndex The index of the glyph
63    * @return true if the glyph is colored
64    */
65   virtual bool IsColorGlyph(GlyphIndex glyphIndex) const = 0;
66
67   /**
68    * Check if the character is supported by this font
69    * @param[in] character The character to test
70    */
71   virtual bool IsCharacterSupported(Character character) = 0;
72
73   /**
74    * Get the point size of this font
75    * @return the point size
76    */
77   virtual PointSize26Dot6 GetPointSize() const = 0;
78
79   /**
80    * Get the index into this font's glyph table of the character
81    *
82    * @param[in] character to look up
83    * @return the glyph index of this character
84    */
85   virtual GlyphIndex GetGlyphIndex(Character character) const = 0;
86
87   /**
88    * Get the index into this font's glyph table of the character
89    *
90    * @param[in] character to look up
91    * @param[in] variantSelector the variation selector modify character code
92    * @return the glyph index of this character
93    */
94   virtual GlyphIndex GetGlyphIndex(Character character, Character variantSelector) const = 0;
95
96   /**
97    * Get the freetype typeface for this font.
98    */
99   virtual FT_Face GetTypeface() const = 0;
100
101   /**
102    * Get the harfbuzz font struct for this font.
103    *
104    * @param[in] horizontalDpi Horizontal DPI for this harfbuzz font.
105    * @param[in] verticalDpi Vertical DPI for this harfbuzz font.
106    * @return the harfbuzz font data, or nullptr if failed.
107    */
108   virtual HarfBuzzFontHandle GetHarfBuzzFont(const uint32_t& horizontalDpi, const uint32_t& verticalDpi) = 0;
109
110   /**
111    * @return true if this font has an italic style
112    */
113   virtual bool HasItalicStyle() const = 0;
114 };
115
116 } // namespace Dali::TextAbstraction::Internal
117
118 #endif // DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_H