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