7a758f3eff2f8073256e7971bee63990a6f43a5a
[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/public-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 Dali::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::GetSystemFonts()
65    */
66   void GetSystemFonts( FontList& systemFonts );
67
68   /**
69    * @copydoc Dali::FontClient::FindSystemFont()
70    */
71   bool FindSystemFont( Character charcode, FontDescription& systemFont );
72
73   /**
74    * @copydoc Dali::FontClient::GetFontId()
75    */
76   FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
77
78   /**
79    * @copydoc Dali::FontClient::FindDefaultFont()
80    */
81   FontId FindDefaultFont( Character charcode );
82
83   /**
84    * @copydoc Dali::FontClient::GetFontMetrics()
85    */
86   void GetFontMetrics( FontId fontId, FontMetrics& metrics );
87
88   /**
89    * @copydoc Dali::FontClient::GetGlyphIndex()
90    */
91   GlyphIndex GetGlyphIndex( FontId fontId, Character charcode );
92
93   /**
94    * @copydoc Dali::FontClient::CreateMetrics()
95    */
96   bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
97
98   /**
99    * @copydoc Dali::FontClient::CreateBitmap()
100    */
101   BitmapImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
102
103 private:
104
105   /**
106    * Helper for lazy initialization.
107    */
108   void CreatePlugin();
109
110   // Undefined copy constructor.
111   FontClient( const FontClient& );
112
113   // Undefined assignment constructor.
114   FontClient& operator=( FontClient& );
115
116 private:
117
118   struct Plugin;
119   Plugin* mPlugin;
120
121   // Allows DPI to be set without loading plugin
122   unsigned int mDpiHorizontal;
123   unsigned int mDpiVertical;
124
125 }; // class FontClient
126
127 } // namespace Internal
128
129 inline static Internal::FontClient& GetImplementation(FontClient& fontClient)
130 {
131   DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
132   BaseObject& handle = fontClient.GetBaseObject();
133   return static_cast<Internal::FontClient&>(handle);
134 }
135
136 inline static const Internal::FontClient& GetImplementation(const FontClient& fontClient)
137 {
138   DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
139   const BaseObject& handle = fontClient.GetBaseObject();
140   return static_cast<const Internal::FontClient&>(handle);
141 }
142
143 } // namespace TextAbstraction
144
145 } // namespace Dali
146
147 #endif // __DALI_INTERNAL_TEXT_ABSTRACTION_FONT_CLIENT_IMPL_H__