Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gnulib-local / lib / libcroco / cr-fonts.h
1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
2
3 /*
4  * This file is part of The Croco Library
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2.1 of 
8  * the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the 
17  * GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Author: Dodji Seketeli
23  * See COPYRIGHTS file for copyright information.
24  */
25
26 #ifndef __CR_FONTS_H__
27 #define __CR_FONTS_H__
28
29 #include "cr-utils.h"
30 #include "cr-num.h"
31
32 /**
33  *@file
34  *Various type declarations about font selection related
35  *properties.
36  */
37 G_BEGIN_DECLS
38
39
40 enum CRFontFamilyType
41 {
42         FONT_FAMILY_SANS_SERIF,
43         FONT_FAMILY_SERIF,      
44         FONT_FAMILY_CURSIVE,
45         FONT_FAMILY_FANTASY,
46         FONT_FAMILY_MONOSPACE,
47         FONT_FAMILY_NON_GENERIC,
48         FONT_FAMILY_INHERIT,
49         /**/
50         NB_FONT_FAMILIE_TYPES
51 } ;
52
53 typedef struct _CRFontFamily CRFontFamily ;
54
55 struct _CRFontFamily
56 {
57         enum CRFontFamilyType type ;
58
59         /*
60          *The name of the font family, in case
61          *it is non generic.
62          *Is set only if the type is FONT_FAMILY_NON_GENERIC.
63          */
64         guchar *name ;
65
66         CRFontFamily *next ;
67         CRFontFamily *prev ;
68 } ;
69
70
71 /**
72  *The different types
73  *of absolute font size.
74  *This is used by the 'font-size'
75  *property defined in css2 spec
76  *in chapter 15.2.4 .
77  *These values a indexes of 
78  *table of size so please, do not
79  *change their definition order unless
80  *you know what you are doing.
81  */
82 enum CRPredefinedAbsoluteFontSize
83 {
84         FONT_SIZE_XX_SMALL=0,
85         FONT_SIZE_X_SMALL,
86         FONT_SIZE_SMALL,
87         FONT_SIZE_MEDIUM,
88         FONT_SIZE_LARGE,
89         FONT_SIZE_X_LARGE,
90         FONT_SIZE_XX_LARGE,
91         FONT_SIZE_INHERIT,
92         NB_PREDEFINED_ABSOLUTE_FONT_SIZES
93 } ;
94
95 /**
96  *The different types
97  *of relative font size.
98  *This is used by the 'font-size'
99  *property defined in css2 spec
100  *in chapter 15.2.4 .
101  *These values a indexes of 
102  *table of size so please, do not
103  *change their definition order unless
104  *you know what you are doing.
105  */
106 enum CRRelativeFontSize
107 {        
108         FONT_SIZE_LARGER,
109         FONT_SIZE_SMALLER,
110         NB_RELATIVE_FONT_SIZE
111 } ;
112
113 /**
114  *The type of font-size property.
115  *Used to define the type of #CRFontSize .
116  *See css2 spec chapter 15.2.4 to understand.
117  */
118 enum CRFontSizeType {
119         /**
120          *If the type of #CRFontSize is
121          *PREDEFINED_ABSOLUTE_FONT_SIZE,
122          *the CRFontSize::value.predefined_absolute 
123          *field will be defined.
124          */
125         PREDEFINED_ABSOLUTE_FONT_SIZE,
126         
127         /**
128          *If the type of #CRFontSize is
129          *ABSOLUTE_FONT_SIZE,
130          *the CRFontSize::value.absolute 
131          *field will be defined.
132          */
133         ABSOLUTE_FONT_SIZE,
134
135         /**
136          *If the type of #CRFontSize is
137          *RELATIVE_FONT_SIZE,
138          *the CRFontSize::value.relative
139          *field will be defined.
140          */
141         RELATIVE_FONT_SIZE,
142
143         /**
144          *If the type of #CRFontSize is
145          *INHERITED_FONT_SIZE,
146          *the None of the field of the CRFontSize::value enum
147          *will be defined.
148          */
149         INHERITED_FONT_SIZE,
150
151         NB_FONT_SIZE_TYPE
152 } ;
153
154 typedef struct _CRFontSize CRFontSize ;
155 struct _CRFontSize {
156         enum CRFontSizeType type ;
157         union  {
158                 enum CRPredefinedAbsoluteFontSize predefined ;
159                 enum CRRelativeFontSize relative ;
160                 CRNum absolute ;
161         } value;
162 } ;
163
164 enum CRFontSizeAdjustType
165 {
166         FONT_SIZE_ADJUST_NONE = 0,
167         FONT_SIZE_ADJUST_NUMBER,
168         FONT_SIZE_ADJUST_INHERIT
169 } ;
170 typedef struct _CRFontSizeAdjust CRFontSizeAdjust ;
171 struct _CRFontSizeAdjust
172 {
173         enum CRFontSizeAdjustType type ;
174         CRNum *num ;
175 } ;
176
177 enum CRFontStyle
178 {
179         FONT_STYLE_NORMAL=0,
180         FONT_STYLE_ITALIC,
181         FONT_STYLE_OBLIQUE,
182         FONT_STYLE_INHERIT
183 } ;
184
185 enum CRFontVariant
186 {
187         FONT_VARIANT_NORMAL=0,
188         FONT_VARIANT_SMALL_CAPS,
189         FONT_VARIANT_INHERIT
190 } ;
191
192 enum CRFontWeight
193 {
194         FONT_WEIGHT_NORMAL = 1,
195         FONT_WEIGHT_BOLD = 1<<1,
196         FONT_WEIGHT_BOLDER = 1<<2,
197         FONT_WEIGHT_LIGHTER = 1<<3,
198         FONT_WEIGHT_100 = 1<<4,
199         FONT_WEIGHT_200 = 1<<5,
200         FONT_WEIGHT_300 = 1<<6,
201         FONT_WEIGHT_400 = 1<<7,
202         FONT_WEIGHT_500 = 1<<8,
203         FONT_WEIGHT_600 = 1<<9,
204         FONT_WEIGHT_700 = 1<<10,
205         FONT_WEIGHT_800 = 1<<11,
206         FONT_WEIGHT_900 = 1<<12,
207         FONT_WEIGHT_INHERIT = 1<<13,
208         NB_FONT_WEIGHTS
209 } ;
210
211 enum CRFontStretch
212 {
213         FONT_STRETCH_NORMAL=0,
214         FONT_STRETCH_WIDER,
215         FONT_STRETCH_NARROWER,
216         FONT_STRETCH_ULTRA_CONDENSED,
217         FONT_STRETCH_EXTRA_CONDENSED,
218         FONT_STRETCH_CONDENSED,
219         FONT_STRETCH_SEMI_CONDENSED,
220         FONT_STRETCH_SEMI_EXPANDED,
221         FONT_STRETCH_EXPANDED,
222         FONT_STRETCH_EXTRA_EXPANDED,
223         FONT_STRETCH_ULTRA_EXPANDED,
224         FONT_STRETCH_INHERIT
225 } ;
226
227 /**************************************
228  *'font-family' manipulation functions
229  ***************************************/
230 CRFontFamily *
231 cr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name) ;
232
233 CRFontFamily *
234 cr_font_family_append (CRFontFamily *a_this, 
235                        CRFontFamily *a_family_to_append) ;
236
237 guchar *
238 cr_font_family_to_string (CRFontFamily *a_this,
239                           gboolean a_walk_font_family_list) ;
240
241 CRFontFamily *
242 cr_font_family_prepend (CRFontFamily *a_this, 
243                         CRFontFamily *a_family_to_prepend);
244
245 enum CRStatus
246 cr_font_family_destroy (CRFontFamily *a_this) ;
247
248 enum CRStatus
249 cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name) ;
250
251
252 /************************************
253  *'font-size' manipulation functions
254  ***********************************/
255
256 CRFontSize * cr_font_size_new (void) ;
257
258 enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
259
260 enum CRStatus cr_font_size_copy (CRFontSize *a_dst, 
261                                  CRFontSize *a_src) ;
262 enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, 
263                                                               enum CRPredefinedAbsoluteFontSize a_predefined) ;
264 enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this,
265                                                    enum CRRelativeFontSize a_relative) ;
266
267 enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this,
268                                                    enum CRNumType a_num_type,
269                                                    gdouble a_value) ;
270
271 enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
272
273 gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
274
275 gchar* cr_font_size_to_string (CRFontSize *a_this) ;
276
277 void cr_font_size_destroy (CRFontSize *a_font_size) ;
278
279 /*******************************************************
280  *'font-size-adjust' manipulation function declarations
281  *******************************************************/
282
283 CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
284
285 gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
286
287 void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
288
289 void 
290 cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
291                                                enum CRPredefinedAbsoluteFontSize *a_smaller_size) ;
292 void
293 cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
294                                               enum CRPredefinedAbsoluteFontSize *a_larger_size) ;
295
296 gboolean
297 cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) ;
298
299 /***********************************
300  *various other font related functions
301  ***********************************/
302 const gchar * cr_font_style_to_string (enum CRFontStyle a_code) ;
303
304 const gchar * cr_font_weight_to_string (enum CRFontWeight a_code)  ;
305
306 enum CRFontWeight
307 cr_font_weight_get_bolder (enum CRFontWeight a_weight) ;
308
309 const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ;
310
311 const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
312
313 G_END_DECLS
314
315 #endif /* __CR_FONTS_H__ */