Merge "Modify to use remote-surface for WatchApplication" into devel/master
[platform/core/uifw/dali-adaptor.git] / text / dali / devel-api / text-abstraction / font-client.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/devel-api/text-abstraction/font-client.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/text-abstraction/font-client-impl.h>
23
24 namespace Dali
25 {
26
27 namespace TextAbstraction
28 {
29
30 const PointSize26Dot6 FontClient::DEFAULT_POINT_SIZE = 768u; // 12*64
31
32 FontClient::GlyphBufferData::GlyphBufferData()
33 : buffer( NULL ),
34   width( 0u ),
35   height( 0u ),
36   format( Pixel::A8 )
37 {
38 }
39
40 FontClient::GlyphBufferData::~GlyphBufferData()
41 {
42 }
43
44 FontClient FontClient::Get()
45 {
46   return Internal::FontClient::Get();
47 }
48
49 FontClient::FontClient()
50 {
51 }
52
53 FontClient::~FontClient()
54 {
55 }
56
57 FontClient::FontClient( const FontClient& handle )
58 : BaseHandle( handle )
59 {
60 }
61
62 FontClient& FontClient::operator=( const FontClient& handle )
63 {
64   BaseHandle::operator=( handle );
65   return *this;
66 }
67
68 void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi  )
69 {
70   GetImplementation(*this).SetDpi( horizontalDpi, verticalDpi );
71 }
72
73 void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi )
74 {
75   GetImplementation(*this).GetDpi( horizontalDpi, verticalDpi );
76 }
77
78 void FontClient::ResetSystemDefaults()
79 {
80   GetImplementation(*this).ResetSystemDefaults();
81 }
82
83 void FontClient::GetDefaultFonts( FontList& defaultFonts )
84 {
85   GetImplementation(*this).GetDefaultFonts( defaultFonts );
86 }
87
88 void FontClient::GetDefaultPlatformFontDescription( FontDescription& fontDescription )
89 {
90   GetImplementation(*this).GetDefaultPlatformFontDescription( fontDescription );
91 }
92
93 void FontClient::GetSystemFonts( FontList& systemFonts )
94 {
95   GetImplementation(*this).GetSystemFonts( systemFonts );
96 }
97
98 void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
99 {
100   GetImplementation(*this).GetDescription( id, fontDescription );
101 }
102
103 PointSize26Dot6 FontClient::GetPointSize( FontId id )
104 {
105   return GetImplementation(*this).GetPointSize( id );
106 }
107
108 FontId FontClient::FindDefaultFont( Character charcode,
109                                     PointSize26Dot6 requestedPointSize,
110                                     bool preferColor )
111 {
112   return GetImplementation(*this).FindDefaultFont( charcode,
113                                                    requestedPointSize,
114                                                    preferColor );
115 }
116
117 FontId FontClient::FindFallbackFont( Character charcode,
118                                      const FontDescription& preferredFontDescription,
119                                      PointSize26Dot6 requestedPointSize,
120                                      bool preferColor )
121 {
122   return GetImplementation(*this).FindFallbackFont( charcode, preferredFontDescription, requestedPointSize, preferColor );
123 }
124
125 FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
126 {
127   return GetImplementation(*this).GetFontId( path, requestedPointSize, faceIndex );
128 }
129
130 FontId FontClient::GetFontId( const FontDescription& fontDescription,
131                               PointSize26Dot6 requestedPointSize,
132                               FaceIndex faceIndex )
133 {
134   return GetImplementation(*this).GetFontId( fontDescription,
135                                              requestedPointSize,
136                                              faceIndex );
137 }
138
139 bool FontClient::IsScalable( const FontPath& path )
140 {
141   return GetImplementation(*this).IsScalable( path );
142 }
143
144 bool FontClient::IsScalable( const FontDescription& fontDescription )
145 {
146   return GetImplementation(*this).IsScalable( fontDescription );
147 }
148
149 void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
150 {
151   GetImplementation(*this).GetFixedSizes( path, sizes );
152 }
153
154 void FontClient::GetFixedSizes( const FontDescription& fontDescription,
155                                 Dali::Vector< PointSize26Dot6 >& sizes )
156 {
157   GetImplementation(*this).GetFixedSizes( fontDescription, sizes );
158 }
159
160 void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
161 {
162   GetImplementation(*this).GetFontMetrics( fontId, metrics );
163 }
164
165 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
166 {
167   return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
168 }
169
170 bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal )
171 {
172   return GetImplementation(*this).GetGlyphMetrics( array, size, type, horizontal );
173 }
174
175 void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, GlyphBufferData& data )
176 {
177   GetImplementation(*this).CreateBitmap( fontId, glyphIndex, data );
178 }
179
180 PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
181 {
182   return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
183 }
184
185 void FontClient::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight )
186 {
187   GetImplementation(*this).CreateVectorBlob( fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight );
188 }
189
190 const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
191 {
192   return GetImplementation(*this).GetEllipsisGlyph( requestedPointSize );
193 }
194
195 bool FontClient::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
196 {
197   return GetImplementation(*this).IsColorGlyph( fontId, glyphIndex );
198 }
199
200 FontClient::FontClient( Internal::FontClient* internal )
201 : BaseHandle( internal )
202 {
203 }
204
205 } // namespace TextAbstraction
206
207 } // namespace Dali