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