Libcroco
cr-fonts.h
Go to the documentation of this file.
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 
41 {
49  /**/
51 } ;
52 
53 typedef struct _CRFontFamily CRFontFamily ;
54 
56 {
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 
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  */
83 {
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  */
107 {
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  */
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  */
126 
127  /**
128  *If the type of #CRFontSize is
129  *ABSOLUTE_FONT_SIZE,
130  *the CRFontSize::value.absolute
131  *field will be defined.
132  */
134 
135  /**
136  *If the type of #CRFontSize is
137  *RELATIVE_FONT_SIZE,
138  *the CRFontSize::value.relative
139  *field will be defined.
140  */
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  */
150 
152 } ;
153 
154 typedef struct _CRFontSize CRFontSize ;
155 struct _CRFontSize {
157  union {
161  } value;
162 } ;
163 
165 {
169 } ;
172 {
175 } ;
176 
178 {
183 } ;
184 
186 {
190 } ;
191 
193 {
209 } ;
210 
212 {
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 *
235  CRFontFamily *a_family_to_append) ;
236 
237 guchar *
239  gboolean a_walk_font_family_list) ;
240 
241 CRFontFamily *
243  CRFontFamily *a_family_to_prepend);
244 
245 enum CRStatus
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 
261  CRFontSize const *a_src) ;
263  enum CRPredefinedAbsoluteFontSize a_predefined) ;
265  enum CRRelativeFontSize a_relative) ;
266 
268  enum CRNumType a_num_type,
269  gdouble a_value) ;
270 
272 
273 gboolean cr_font_size_is_set_to_inherit (CRFontSize const *a_this) ;
274 
275 gchar* cr_font_size_to_string (CRFontSize const *a_this) ;
276 
277 void cr_font_size_destroy (CRFontSize *a_font_size) ;
278 
279 /*******************************************************
280  *'font-size-adjust' manipulation function declarations
281  *******************************************************/
282 
284 
285 gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this) ;
286 
288 
289 void
291  enum CRPredefinedAbsoluteFontSize *a_smaller_size) ;
292 void
294  enum CRPredefinedAbsoluteFontSize *a_larger_size) ;
295 
296 gboolean
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
guchar * cr_font_family_to_string(CRFontFamily const *a_this, gboolean a_walk_font_family_list)
cr_font_family_to_string: @a_this: the current instance of CRFontFamily.
Definition: cr-fonts.c:182
enum CRStatus cr_font_size_set_predefined_absolute_font_size(CRFontSize *a_this, enum CRPredefinedAbsoluteFontSize a_predefined)
cr_font_size_set_predefined_absolute_font_size: @a_this: the current instance of CRFontSize.
Definition: cr-fonts.c:419
union _CRFontSize::@0 value
CRNum absolute
Definition: cr-fonts.h:160
enum CRStatus cr_font_size_set_relative_font_size(CRFontSize *a_this, enum CRRelativeFontSize a_relative)
cr_font_size_set_relative_font_size: @a_this: the current instance of CRFontSize @a_relative: the new...
Definition: cr-fonts.c:441
enum CRStatus cr_font_size_clear(CRFontSize *a_this)
cr_font_size_clear: @a_this: the current instance of CRFontSize
Definition: cr-fonts.c:356
CRFontFamily * cr_font_family_prepend(CRFontFamily *a_this, CRFontFamily *a_family_to_prepend)
cr_font_family_prepend: @a_this: the current instance CRFontFamily.
Definition: cr-fonts.c:277
CRFontFamily * next
Definition: cr-fonts.h:66
The Croco library basic types definitions And global definitions.
enum CRFontFamilyType type
Definition: cr-fonts.h:57
void cr_font_size_adjust_destroy(CRFontSizeAdjust *a_this)
cr_font_size_adjust_destroy: @a_this: the current instance of CRFontSizeAdjust.
Definition: cr-fonts.c:941
enum CRStatus cr_font_family_destroy(CRFontFamily *a_this)
cr_font_family_destroy: @a_this: the current instance of CRFontFamily.
Definition: cr-fonts.c:298
void cr_font_size_get_larger_predefined_font_size(enum CRPredefinedAbsoluteFontSize a_font_size, enum CRPredefinedAbsoluteFontSize *a_larger_size)
cr_font_size_get_larger_predefined_font_size: @a_font_size: the font size to consider.
Definition: cr-fonts.c:607
If the type of CRFontSize is INHERITED_FONT_SIZE, the None of the field of the CRFontSize::value enum...
Definition: cr-fonts.h:149
gchar * cr_font_size_to_string(CRFontSize const *a_this)
cr_font_size_to_string: @a_this: the current instance of CRFontSize
Definition: cr-fonts.c:517
guchar * name
Definition: cr-fonts.h:64
enum CRRelativeFontSize relative
Definition: cr-fonts.h:159
const gchar * cr_font_stretch_to_string(enum CRFontStretch a_code)
cr_font_stretch_to_string: @a_code: the instance of CRFontStretch to consider.
Definition: cr-fonts.c:853
If the type of CRFontSize is ABSOLUTE_FONT_SIZE, the CRFontSize::value.absolute field will be defined...
Definition: cr-fonts.h:133
CRFontSizeAdjust * cr_font_size_adjust_new(void)
cr_font_size_adjust_new:
Definition: cr-fonts.c:921
CRStatus
The status type returned by the methods of the croco library.
Definition: cr-utils.h:43
enum CRFontWeight cr_font_weight_get_bolder(enum CRFontWeight a_weight)
cr_font_weight_get_bolder: @a_weight: the CRFontWeight to consider.
Definition: cr-fonts.c:767
gchar * cr_font_size_adjust_to_string(CRFontSizeAdjust const *a_this)
cr_font_size_adjust_to_string: @a_this: the instance of CRFontSizeAdjust.
Definition: cr-fonts.c:676
CRFontStyle
Definition: cr-fonts.h:177
CRFontSizeType
The type of font-size property.
Definition: cr-fonts.h:118
enum CRStatus cr_font_size_set_to_inherit(CRFontSize *a_this)
cr_font_size_set_to_inherit: @a_this: the current instance of CRFontSize
Definition: cr-fonts.c:485
CRFontVariant
Definition: cr-fonts.h:185
enum CRStatus cr_font_size_set_absolute_font_size(CRFontSize *a_this, enum CRNumType a_num_type, gdouble a_value)
cr_font_size_set_absolute_font_size: @a_this: the current instance of CRFontSize @a_num_type: the typ...
Definition: cr-fonts.c:463
CRPredefinedAbsoluteFontSize
The different types of absolute font size.
Definition: cr-fonts.h:82
enum CRStatus cr_font_family_set_name(CRFontFamily *a_this, guchar *a_name)
cr_font_family_set_name: @a_this: the current instance of CRFontFamily.
Definition: cr-fonts.c:221
gboolean cr_font_size_is_predefined_absolute_font_size(enum CRPredefinedAbsoluteFontSize a_font_size)
cr_font_size_is_predefined_absolute_font_size: @a_font_size: the font size to consider.
Definition: cr-fonts.c:659
enum CRFontSizeAdjustType type
Definition: cr-fonts.h:173
The declaration of the CRNum class.
If the type of CRFontSize is RELATIVE_FONT_SIZE, the CRFontSize::value.relative field will be defined...
Definition: cr-fonts.h:141
If the type of CRFontSize is PREDEFINED_ABSOLUTE_FONT_SIZE, the CRFontSize::value....
Definition: cr-fonts.h:125
CRRelativeFontSize
The different types of relative font size.
Definition: cr-fonts.h:106
CRNumType
The different types of numbers.
Definition: cr-num.h:54
CRFontSizeAdjustType
Definition: cr-fonts.h:164
const gchar * cr_font_weight_to_string(enum CRFontWeight a_code)
cr_font_weight_to_string: @a_code: the font weight to consider.
Definition: cr-fonts.c:792
CRFontStretch
Definition: cr-fonts.h:211
An abstraction of a number (num) as defined in the css2 spec.
Definition: cr-num.h:90
CRFontSize * cr_font_size_new(void)
cr_font_size_new:
Definition: cr-fonts.c:335
gboolean cr_font_size_is_set_to_inherit(CRFontSize const *a_this)
cr_font_size_is_set_to_inherit: @a_this: the current instance of CRFontSize.
Definition: cr-fonts.c:502
CRFontFamily * cr_font_family_append(CRFontFamily *a_this, CRFontFamily *a_family_to_append)
cr_font_family_append: @a_this: the current instance of CRFontFamily.
Definition: cr-fonts.c:250
CRFontWeight
Definition: cr-fonts.h:192
const gchar * cr_font_variant_to_string(enum CRFontVariant a_code)
cr_font_variant_to_string: @a_code: the current instance of CRFontVariant.
Definition: cr-fonts.c:742
void cr_font_size_get_smaller_predefined_font_size(enum CRPredefinedAbsoluteFontSize a_font_size, enum CRPredefinedAbsoluteFontSize *a_smaller_size)
cr_font_size_get_smaller_predefined: @a_font_size: the font size to consider.
Definition: cr-fonts.c:554
enum CRFontSizeType type
Definition: cr-fonts.h:156
CRFontFamily * cr_font_family_new(enum CRFontFamilyType a_type, guchar *a_name)
cr_font_family_new: @a_type: the type of font family to create.
Definition: cr-fonts.c:154
void cr_font_size_destroy(CRFontSize *a_font_size)
cr_font_size_destroy: @a_font_size: the font size to destroy
Definition: cr-fonts.c:904
const gchar * cr_font_style_to_string(enum CRFontStyle a_code)
cr_font_style_to_string: @a_code: the current instance of CRFontStyle .
Definition: cr-fonts.c:710
CRFontFamily * prev
Definition: cr-fonts.h:67
CRFontFamilyType
Definition: cr-fonts.h:40
enum CRPredefinedAbsoluteFontSize predefined
Definition: cr-fonts.h:158
enum CRStatus cr_font_size_copy(CRFontSize *a_dst, CRFontSize const *a_src)
cr_font_size_copy: @a_dst: the destination CRFontSize (where to copy to).
Definition: cr-fonts.c:386