[Tizen] Add support for FontClientFontPreLoad API
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / text-abstraction / font-list.h
1 #ifndef DALI_TEXT_ABSTRACTION_FONT_LIST_H
2 #define DALI_TEXT_ABSTRACTION_FONT_LIST_H
3
4 /*
5  * Copyright (c) 2022 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/common/vector-wrapper.h>
23 #include <iostream>
24 #include <string>
25
26 // INTERNAL INCLUDES
27 #include <dali/public-api/dali-adaptor-common.h>
28
29 namespace Dali
30 {
31 namespace TextAbstraction
32 {
33 typedef std::string FontPath;
34 typedef std::string FontFamily;
35 typedef std::string FontStyle;
36 typedef std::vector<FontFamily> FontFamilyList;
37 typedef std::vector<FontPath> FontPathList;
38
39 namespace FontWidth
40 {
41 /**
42    * @brief Enumeration type for the font's width
43    */
44 enum Type
45 {
46   NONE, ///< Means not defined. Will use what is set as default, currently NORMAL.
47   ULTRA_CONDENSED,
48   EXTRA_CONDENSED,
49   CONDENSED,
50   SEMI_CONDENSED,
51   NORMAL,
52   SEMI_EXPANDED,
53   EXPANDED,
54   EXTRA_EXPANDED,
55   ULTRA_EXPANDED
56 };
57
58 const char* const Name[] =
59   {
60     "NONE",
61     "ULTRA_CONDENSED",
62     "EXTRA_CONDENSED",
63     "CONDENSED",
64     "SEMI_CONDENSED",
65     "NORMAL",
66     "SEMI_EXPANDED",
67     "EXPANDED",
68     "EXTRA_EXPANDED",
69     "ULTRA_EXPANDED"};
70 } // namespace FontWidth
71
72 namespace FontWeight
73 {
74 /**
75    * @brief Enumeration type for the font's weight
76    */
77 enum Type
78 {
79   NONE, ///< Means not defined. Will use what is set as default, currently NORMAL.
80   THIN,
81   ULTRA_LIGHT,
82   EXTRA_LIGHT = ULTRA_LIGHT,
83   LIGHT,
84   DEMI_LIGHT,
85   SEMI_LIGHT = DEMI_LIGHT,
86   BOOK,
87   NORMAL,
88   REGULAR = NORMAL,
89   MEDIUM,
90   DEMI_BOLD,
91   SEMI_BOLD = DEMI_BOLD,
92   BOLD,
93   ULTRA_BOLD,
94   EXTRA_BOLD = ULTRA_BOLD,
95   BLACK,
96   HEAVY       = BLACK,
97   EXTRA_BLACK = BLACK
98 };
99
100 const char* const Name[] =
101   {
102     "NONE",
103     "THIN",
104     "ULTRA_LIGHT",
105     "LIGHT",
106     "DEMI_LIGHT",
107     "BOOK",
108     "NORMAL",
109     "MEDIUM",
110     "DEMI_BOLD",
111     "BOLD",
112     "ULTRA_BOLD",
113     "BLACK"};
114 } // namespace FontWeight
115
116 namespace FontSlant
117 {
118 /**
119    * @brief Enumeration type for the font's slant
120    */
121 enum Type
122 {
123   NONE, ///< Means not defined. Will use what is set as default, currently NORMAL.
124   NORMAL,
125   ROMAN = NORMAL,
126   ITALIC,
127   OBLIQUE
128 };
129
130 const char* const Name[] =
131   {
132     "NONE",
133     "NORMAL",
134     "ITALIC",
135     "OBLIQUE"};
136 } // namespace FontSlant
137
138 struct FontDescription
139 {
140   enum Type
141   {
142     INVALID,     ///< Not valid font.
143     FACE_FONT,   ///< A face font.
144     BITMAP_FONT, ///< A bitmap font. Each glyph has a url with the bitmap.
145   };
146
147   FontDescription()
148   : path(),
149     family(),
150     width(FontWidth::NONE),
151     weight(FontWeight::NONE),
152     slant(FontSlant::NONE),
153     type(INVALID)
154   {
155   }
156
157   FontDescription(const FontPath&         path,
158                   const FontFamily&       family,
159                   const FontWidth::Type&  width,
160                   const FontWeight::Type& weight,
161                   const FontSlant::Type&  slant,
162                   const Type&             type)
163   : path(path),
164     family(family),
165     width(width),
166     weight(weight),
167     slant(slant),
168     type(type)
169   {
170   }
171
172   ~FontDescription()
173   {
174   }
175
176   FontPath         path;   ///< The font's file name path.
177   FontFamily       family; ///< The font's family name.
178   FontWidth::Type  width;  ///< The font's width.
179   FontWeight::Type weight; ///< The font's weight.
180   FontSlant::Type  slant;  ///< The font's slant.
181   Type             type;   ///< The type of font.
182 };
183
184 typedef std::vector<FontDescription> FontList;
185
186 DALI_ADAPTOR_API std::ostream& operator<<(std::ostream& o, const FontList& fontList);
187
188 } // namespace TextAbstraction
189
190 } // namespace Dali
191
192 #endif // DALI_TEXT_ABSTRACTION_FONT_LIST_H