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 {
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 
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 {
156  enum CRFontSizeType type ;
157  union {
161  } value;
162 } ;
163 
165 {
169 } ;
170 typedef struct _CRFontSizeAdjust CRFontSizeAdjust ;
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
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
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
CRFontSize * cr_font_size_new(void)
cr_font_size_new:
Definition: cr-fonts.c:335
CRPredefinedAbsoluteFontSize
The different types of absolute font size.
Definition: cr-fonts.h:83
@ FONT_SIZE_XX_LARGE
Definition: cr-fonts.h:90
@ FONT_SIZE_LARGE
Definition: cr-fonts.h:88
@ FONT_SIZE_INHERIT
Definition: cr-fonts.h:91
@ FONT_SIZE_MEDIUM
Definition: cr-fonts.h:87
@ FONT_SIZE_X_LARGE
Definition: cr-fonts.h:89
@ NB_PREDEFINED_ABSOLUTE_FONT_SIZES
Definition: cr-fonts.h:92
@ FONT_SIZE_SMALL
Definition: cr-fonts.h:86
@ FONT_SIZE_XX_SMALL
Definition: cr-fonts.h:84
@ FONT_SIZE_X_SMALL
Definition: cr-fonts.h:85
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
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
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
CRFontVariant
Definition: cr-fonts.h:186
@ FONT_VARIANT_SMALL_CAPS
Definition: cr-fonts.h:188
@ FONT_VARIANT_INHERIT
Definition: cr-fonts.h:189
@ FONT_VARIANT_NORMAL
Definition: cr-fonts.h:187
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
CRFontSizeAdjust * cr_font_size_adjust_new(void)
cr_font_size_adjust_new:
Definition: cr-fonts.c:921
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
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
CRFontStretch
Definition: cr-fonts.h:212
@ FONT_STRETCH_EXPANDED
Definition: cr-fonts.h:221
@ FONT_STRETCH_SEMI_EXPANDED
Definition: cr-fonts.h:220
@ FONT_STRETCH_NARROWER
Definition: cr-fonts.h:215
@ FONT_STRETCH_WIDER
Definition: cr-fonts.h:214
@ FONT_STRETCH_ULTRA_CONDENSED
Definition: cr-fonts.h:216
@ FONT_STRETCH_NORMAL
Definition: cr-fonts.h:213
@ FONT_STRETCH_EXTRA_CONDENSED
Definition: cr-fonts.h:217
@ FONT_STRETCH_SEMI_CONDENSED
Definition: cr-fonts.h:219
@ FONT_STRETCH_INHERIT
Definition: cr-fonts.h:224
@ FONT_STRETCH_EXTRA_EXPANDED
Definition: cr-fonts.h:222
@ FONT_STRETCH_ULTRA_EXPANDED
Definition: cr-fonts.h:223
@ FONT_STRETCH_CONDENSED
Definition: cr-fonts.h:218
CRFontSizeType
The type of font-size property.
Definition: cr-fonts.h:118
@ PREDEFINED_ABSOLUTE_FONT_SIZE
If the type of CRFontSize is PREDEFINED_ABSOLUTE_FONT_SIZE, the CRFontSize::value....
Definition: cr-fonts.h:125
@ RELATIVE_FONT_SIZE
If the type of CRFontSize is RELATIVE_FONT_SIZE, the CRFontSize::value.relative field will be defined...
Definition: cr-fonts.h:141
@ INHERITED_FONT_SIZE
If the type of CRFontSize is INHERITED_FONT_SIZE, the None of the field of the CRFontSize::value enum...
Definition: cr-fonts.h:149
@ NB_FONT_SIZE_TYPE
Definition: cr-fonts.h:151
@ ABSOLUTE_FONT_SIZE
If the type of CRFontSize is ABSOLUTE_FONT_SIZE, the CRFontSize::value.absolute field will be defined...
Definition: cr-fonts.h:133
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
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
CRFontFamilyType
Definition: cr-fonts.h:41
@ FONT_FAMILY_SANS_SERIF
Definition: cr-fonts.h:42
@ FONT_FAMILY_MONOSPACE
Definition: cr-fonts.h:46
@ FONT_FAMILY_INHERIT
Definition: cr-fonts.h:48
@ FONT_FAMILY_CURSIVE
Definition: cr-fonts.h:44
@ FONT_FAMILY_SERIF
Definition: cr-fonts.h:43
@ NB_FONT_FAMILIE_TYPES
Definition: cr-fonts.h:50
@ FONT_FAMILY_NON_GENERIC
Definition: cr-fonts.h:47
@ FONT_FAMILY_FANTASY
Definition: cr-fonts.h:45
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
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
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
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
CRFontStyle
Definition: cr-fonts.h:178
@ FONT_STYLE_NORMAL
Definition: cr-fonts.h:179
@ FONT_STYLE_OBLIQUE
Definition: cr-fonts.h:181
@ FONT_STYLE_ITALIC
Definition: cr-fonts.h:180
@ FONT_STYLE_INHERIT
Definition: cr-fonts.h:182
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_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
CRFontWeight
Definition: cr-fonts.h:193
@ FONT_WEIGHT_300
Definition: cr-fonts.h:200
@ FONT_WEIGHT_100
Definition: cr-fonts.h:198
@ FONT_WEIGHT_BOLDER
Definition: cr-fonts.h:196
@ FONT_WEIGHT_200
Definition: cr-fonts.h:199
@ FONT_WEIGHT_400
Definition: cr-fonts.h:201
@ FONT_WEIGHT_600
Definition: cr-fonts.h:203
@ FONT_WEIGHT_LIGHTER
Definition: cr-fonts.h:197
@ FONT_WEIGHT_BOLD
Definition: cr-fonts.h:195
@ FONT_WEIGHT_900
Definition: cr-fonts.h:206
@ FONT_WEIGHT_800
Definition: cr-fonts.h:205
@ FONT_WEIGHT_INHERIT
Definition: cr-fonts.h:207
@ FONT_WEIGHT_NORMAL
Definition: cr-fonts.h:194
@ NB_FONT_WEIGHTS
Definition: cr-fonts.h:208
@ FONT_WEIGHT_700
Definition: cr-fonts.h:204
@ FONT_WEIGHT_500
Definition: cr-fonts.h:202
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
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
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
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
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
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
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
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
CRFontSizeAdjustType
Definition: cr-fonts.h:165
@ FONT_SIZE_ADJUST_NUMBER
Definition: cr-fonts.h:167
@ FONT_SIZE_ADJUST_NONE
Definition: cr-fonts.h:166
@ FONT_SIZE_ADJUST_INHERIT
Definition: cr-fonts.h:168
CRRelativeFontSize
The different types of relative font size.
Definition: cr-fonts.h:107
@ FONT_SIZE_SMALLER
Definition: cr-fonts.h:109
@ FONT_SIZE_LARGER
Definition: cr-fonts.h:108
@ NB_RELATIVE_FONT_SIZE
Definition: cr-fonts.h:110
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
The declaration of the CRNum class.
CRNumType
The different types of numbers.
Definition: cr-num.h:55
The Croco library basic types definitions And global definitions.
CRStatus
The status type returned by the methods of the croco library.
Definition: cr-utils.h:43
CRFontFamily * prev
Definition: cr-fonts.h:67
enum CRFontFamilyType type
Definition: cr-fonts.h:57
guchar * name
Definition: cr-fonts.h:64
CRFontFamily * next
Definition: cr-fonts.h:66
enum CRFontSizeAdjustType type
Definition: cr-fonts.h:173
enum CRFontSizeType type
Definition: cr-fonts.h:156
CRNum absolute
Definition: cr-fonts.h:160
union _CRFontSize::@0 value
enum CRPredefinedAbsoluteFontSize predefined
Definition: cr-fonts.h:158
enum CRRelativeFontSize relative
Definition: cr-fonts.h:159
An abstraction of a number (num) as defined in the css2 spec.
Definition: cr-num.h:91