e8fba7f2b4832af045207a9d197761fc7285ffc6
[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 FontClient::Get()
33 {
34   return Internal::FontClient::Get();
35 }
36
37 FontClient::FontClient()
38 {
39 }
40
41 FontClient::~FontClient()
42 {
43 }
44
45 FontClient::FontClient( const FontClient& handle )
46 : BaseHandle( handle )
47 {
48 }
49
50 FontClient& FontClient::operator=( const FontClient& handle )
51 {
52   BaseHandle::operator=( handle );
53   return *this;
54 }
55
56 void FontClient::SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi  )
57 {
58   GetImplementation(*this).SetDpi( horizontalDpi, verticalDpi );
59 }
60
61 void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi )
62 {
63   GetImplementation(*this).GetDpi( horizontalDpi, verticalDpi );
64 }
65
66 void FontClient::ResetSystemDefaults()
67 {
68   GetImplementation(*this).ResetSystemDefaults();
69 }
70
71 void FontClient::GetDefaultFonts( FontList& defaultFonts )
72 {
73   GetImplementation(*this).GetDefaultFonts( defaultFonts );
74 }
75
76 void FontClient::GetDefaultPlatformFontDescription( FontDescription& fontDescription )
77 {
78   GetImplementation(*this).GetDefaultPlatformFontDescription( fontDescription );
79 }
80
81 void FontClient::GetSystemFonts( FontList& systemFonts )
82 {
83   GetImplementation(*this).GetSystemFonts( systemFonts );
84 }
85
86 void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
87 {
88   GetImplementation(*this).GetDescription( id, fontDescription );
89 }
90
91 PointSize26Dot6 FontClient::GetPointSize( FontId id )
92 {
93   return GetImplementation(*this).GetPointSize( id );
94 }
95
96 FontId FontClient::FindDefaultFont( Character charcode,
97                                     PointSize26Dot6 requestedPointSize,
98                                     bool preferColor )
99 {
100   return GetImplementation(*this).FindDefaultFont( charcode,
101                                                    requestedPointSize,
102                                                    preferColor );
103 }
104
105 FontId FontClient::FindFallbackFont( Character charcode,
106                                      const FontDescription& preferredFontDescription,
107                                      PointSize26Dot6 requestedPointSize,
108                                      bool preferColor )
109 {
110   return GetImplementation(*this).FindFallbackFont( charcode, preferredFontDescription, requestedPointSize, preferColor );
111 }
112
113 FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex )
114 {
115   return GetImplementation(*this).GetFontId( path, requestedPointSize, faceIndex );
116 }
117
118 FontId FontClient::GetFontId( const FontDescription& fontDescription,
119                               PointSize26Dot6 requestedPointSize,
120                               FaceIndex faceIndex )
121 {
122   return GetImplementation(*this).GetFontId( fontDescription,
123                                              requestedPointSize,
124                                              faceIndex );
125 }
126
127 bool FontClient::IsScalable( const FontPath& path )
128 {
129   return GetImplementation(*this).IsScalable( path );
130 }
131
132 bool FontClient::IsScalable( const FontDescription& fontDescription )
133 {
134   return GetImplementation(*this).IsScalable( fontDescription );
135 }
136
137 void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
138 {
139   GetImplementation(*this).GetFixedSizes( path, sizes );
140 }
141
142 void FontClient::GetFixedSizes( const FontDescription& fontDescription,
143                                 Dali::Vector< PointSize26Dot6 >& sizes )
144 {
145   GetImplementation(*this).GetFixedSizes( fontDescription, sizes );
146 }
147
148 void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
149 {
150   GetImplementation(*this).GetFontMetrics( fontId, metrics );
151 }
152
153 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
154 {
155   return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
156 }
157
158 bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal )
159 {
160   return GetImplementation(*this).GetGlyphMetrics( array, size, type, horizontal );
161 }
162
163 PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
164 {
165   return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
166 }
167
168 void FontClient::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob, unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight )
169 {
170   GetImplementation(*this).CreateVectorBlob( fontId, glyphIndex, blob, blobLength, nominalWidth, nominalHeight );
171 }
172
173 const GlyphInfo& FontClient::GetEllipsisGlyph( PointSize26Dot6 requestedPointSize )
174 {
175   return GetImplementation(*this).GetEllipsisGlyph( requestedPointSize );
176 }
177
178 FontClient::FontClient( Internal::FontClient* internal )
179 : BaseHandle( internal )
180 {
181 }
182
183 } // namespace TextAbstraction
184
185 } // namespace Dali