Refactored font-client-plugin-impl
[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) 2021 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 #include <dali/devel-api/text-abstraction/font-client.h>
21 #include <dali/devel-api/text-abstraction/font-metrics.h>
22 #include <dali/devel-api/text-abstraction/glyph-info.h>
23
24 #include <ft2build.h>
25 #include FT_FREETYPE_H
26
27 namespace Dali::TextAbstraction::Internal
28 {
29 struct FontCacheItemInterface
30 {
31   /**
32    * Get the font metrics
33    *
34    * @param[out] metrics The metrics struct to fill out
35    */
36   virtual void GetFontMetrics(FontMetrics& metrics, unsigned int dpiVertical) const = 0;
37
38   /**
39    * Get glyph metrics
40    *
41    * @param[in,out] glyph The glyph to fill
42    */
43   virtual bool GetGlyphMetrics(GlyphInfo& glyph, unsigned int dpiVertical, bool horizontal) const = 0;
44
45   /**
46    * Create a bitmap for the given glyph
47    *
48    * @param[in] glyphIndex The index of the glyph
49    * @param[out] data The bitmap data for the glyph
50    * @param[in] outlineWidth
51    * @param[in] isItalicRequired
52    * @param[in] isBoldRequired
53    */
54   virtual void CreateBitmap(GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth, bool isItalicRequired, bool isBoldRequired) const = 0;
55
56   /**
57    * Return true if the glyph is colored
58    *
59    * @param[in] glyphIndex The index of the glyph
60    * @return true if the glyph is colored
61    */
62   virtual bool IsColorGlyph(GlyphIndex glyphIndex) const = 0;
63
64   /**
65    * Check if the character is supported by this font
66    * @param[in] character The character to test
67    */
68   virtual bool IsCharacterSupported(Character character) = 0;
69
70   /**
71    * Get the point size of this font
72    * @return the point size
73    */
74   virtual PointSize26Dot6 GetPointSize() const = 0;
75
76   /**
77    * Get the index into this font's glyph table of the character
78    *
79    * @param[in] character to look up
80    * @return the glyph index of this character
81    */
82   virtual GlyphIndex GetGlyphIndex(Character character) const = 0;
83
84   /**
85    * Get the freetype typeface for this font.
86    */
87   virtual FT_Face GetTypeface() const = 0;
88
89   /**
90    * @return true if this font has an italic style
91    */
92   virtual bool HasItalicStyle() const = 0;
93 };
94
95 } // namespace Dali::TextAbstraction::Internal
96
97 #endif // DALI_TEST_ABSTRACTION_INTERNAL_FONT_CACHE_ITEM_INTERFACE_H