Support for fixed size fonts in FreeType2
[platform/core/uifw/dali-adaptor.git] / text / dali / public-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/public-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::SetDefaultFontFamily( const std::string& fontFamilyName,
62                                        const std::string& fontStyle )
63 {
64   GetImplementation(*this).SetDefaultFontFamily( fontFamilyName, fontStyle );
65 }
66
67 void FontClient::GetDefaultFonts( FontList& defaultFonts )
68 {
69   GetImplementation(*this).GetDefaultFonts( defaultFonts );
70 }
71
72 void FontClient::GetSystemFonts( FontList& systemFonts )
73 {
74   GetImplementation(*this).GetSystemFonts( systemFonts );
75 }
76
77 void FontClient::GetDescription( FontId id, FontDescription& fontDescription )
78 {
79   GetImplementation(*this).GetDescription( id, fontDescription );
80 }
81
82 PointSize26Dot6 FontClient::GetPointSize( FontId id )
83 {
84   return GetImplementation(*this).GetPointSize( id );
85 }
86
87 FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSize )
88 {
89   return GetImplementation(*this).FindDefaultFont( charcode, pointSize );
90 }
91
92 FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
93 {
94   return GetImplementation(*this).GetFontId( path, pointSize, faceIndex );
95 }
96
97 FontId FontClient::GetFontId( const FontFamily& fontFamily,
98                               const FontStyle& fontStyle,
99                               PointSize26Dot6 pointSize,
100                               FaceIndex faceIndex )
101 {
102   return GetImplementation(*this).GetFontId( fontFamily,
103                                              fontStyle,
104                                              pointSize,
105                                              faceIndex );
106 }
107
108 void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics )
109 {
110   GetImplementation(*this).GetFontMetrics( fontId, metrics );
111 }
112
113 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
114 {
115   return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
116 }
117
118 bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal )
119 {
120   return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal );
121 }
122
123 BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
124 {
125   return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
126 }
127
128 bool FontClient::IsScalable( const FontPath& path )
129 {
130   return GetImplementation(*this).IsScalable( path );;
131 }
132
133 bool FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& style )
134 {
135   return GetImplementation(*this).IsScalable( fontFamily, style );
136 }
137
138 void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
139 {
140   GetImplementation(*this).GetFixedSizes( path, sizes );
141 }
142
143 void FontClient::GetFixedSizes( const FontFamily& fontFamily,
144                                 const FontStyle& style,
145                                 Dali::Vector< PointSize26Dot6 >& sizes )
146 {
147   GetImplementation(*this).GetFixedSizes( fontFamily, style, sizes );
148 }
149
150 FontClient::FontClient( Internal::FontClient* internal )
151 : BaseHandle( internal )
152 {
153 }
154
155 } // namespace TextAbstraction
156
157 } // namespace Dali