Merge "Fix VD prevent issues" into devel/master
[platform/core/uifw/dali-adaptor.git] / text / dali / internal / text-abstraction / font-client-impl.h
1 #ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
2 #define __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__
3
4 /*
5  * Copyright (c) 2015 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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/text-abstraction/font-client.h>
26
27 namespace Dali
28 {
29
30 namespace TextAbstraction
31 {
32
33 namespace Internal
34 {
35
36 /**
37  * Implementation of the FontClient
38  */
39 class FontClient : public BaseObject
40 {
41 public:
42
43   /**
44    * Constructor
45    */
46   FontClient();
47
48   /**
49    * Destructor
50    */
51   ~FontClient();
52
53   /**
54    * @copydoc Dali::FontClient::Get()
55    */
56   static Dali::TextAbstraction::FontClient Get();
57
58   /**
59    * @copydoc Dali::FontClient::SetDpi()
60    */
61   void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
62
63   /**
64    * @copydoc Dali::FontClient::GetDpi()
65    */
66   void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
67
68   /**
69    * @copydoc Dali::FontClient::SetDefaultFont()
70    */
71   void SetDefaultFont( const FontDescription& fontDescription );
72
73   /**
74    * @copydoc Dali::FontClient::GetDefaultFonts()
75    */
76   void GetDefaultFonts( FontList& defaultFonts );
77
78   /**
79    * @copydoc Dali::FontClient::GetSystemFonts()
80    */
81   void GetSystemFonts( FontList& systemFonts );
82
83   /**
84    * @copydoc Dali::FontClient::GetDescription()
85    */
86   void GetDescription( FontId id, FontDescription& fontDescription );
87
88   /**
89    * @copydoc Dali::FontClient::GetPointSize()
90    */
91   PointSize26Dot6 GetPointSize( FontId id );
92
93   /**
94    * @copydoc Dali::FontClient::FindDefaultFont()
95    */
96   FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor );
97
98   /**
99    * @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
100    */
101   FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
102
103   /**
104    * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 pointSize, FaceIndex faceIndex )
105    */
106   FontId GetFontId( const FontDescription& fontDescription,
107                     PointSize26Dot6 pointSize,
108                     FaceIndex faceIndex );
109
110   /**
111    * @copydoc Dali::FontClient::IsScalable( const FontPath& path )
112    */
113   bool IsScalable( const FontPath& path );
114
115   /**
116    * @copydoc Dali::FontClient::IsScalable( const FontDescription& fontDescription )
117    */
118   bool IsScalable( const FontDescription& fontDescription );
119
120   /**
121    * @copydoc Dali::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
122    */
123   void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
124
125   /**
126    * @copydoc Dali::FontClient::GetFixedSizes()
127    */
128   void GetFixedSizes( const FontDescription& fontDescription,
129                       Dali::Vector< PointSize26Dot6 >& sizes );
130
131   /**
132    * @copydoc Dali::FontClient::GetFontMetrics()
133    */
134   void GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize );
135
136   /**
137    * @copydoc Dali::FontClient::GetGlyphIndex()
138    */
139   GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
140
141   /**
142    * @copydoc Dali::FontClient::GetGlyphMetrics()
143    */
144   bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int maxFixedSize );
145
146   /**
147    * @copydoc Dali::FontClient::CreateBitmap()
148    */
149   BufferImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
150
151   /**
152    * @copydoc Dali::FontClient::GetEllipsisGlyph()
153    */
154   const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 pointSize );
155
156 private:
157
158   /**
159    * Helper for lazy initialization.
160    */
161   void CreatePlugin();
162
163   // Undefined copy constructor.
164   FontClient( const FontClient& );
165
166   // Undefined assignment constructor.
167   FontClient& operator=( FontClient& );
168
169 private:
170
171   struct Plugin;
172   Plugin* mPlugin;
173
174   // Allows DPI to be set without loading plugin
175   unsigned int mDpiHorizontal;
176   unsigned int mDpiVertical;
177
178 }; // class FontClient
179
180 } // namespace Internal
181
182 inline static Internal::FontClient& GetImplementation(FontClient& fontClient)
183 {
184   DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
185   BaseObject& handle = fontClient.GetBaseObject();
186   return static_cast<Internal::FontClient&>(handle);
187 }
188
189 inline static const Internal::FontClient& GetImplementation(const FontClient& fontClient)
190 {
191   DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
192   const BaseObject& handle = fontClient.GetBaseObject();
193   return static_cast<const Internal::FontClient&>(handle);
194 }
195
196 } // namespace TextAbstraction
197
198 } // namespace Dali
199
200 #endif // __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__