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
FONT_FAMILY_SANS_SERIF
@ FONT_FAMILY_SANS_SERIF
Definition: cr-fonts.h:42
FONT_SIZE_X_LARGE
@ FONT_SIZE_X_LARGE
Definition: cr-fonts.h:89
_CRFontSize::type
enum CRFontSizeType type
Definition: cr-fonts.h:156
FONT_FAMILY_CURSIVE
@ FONT_FAMILY_CURSIVE
Definition: cr-fonts.h:44
cr_font_size_is_predefined_absolute_font_size
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
cr_font_size_to_string
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
FONT_SIZE_SMALLER
@ FONT_SIZE_SMALLER
Definition: cr-fonts.h:109
CRPredefinedAbsoluteFontSize
CRPredefinedAbsoluteFontSize
The different types of absolute font size.
Definition: cr-fonts.h:82
FONT_WEIGHT_BOLD
@ FONT_WEIGHT_BOLD
Definition: cr-fonts.h:195
cr_font_family_destroy
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
FONT_STRETCH_NORMAL
@ FONT_STRETCH_NORMAL
Definition: cr-fonts.h:213
PREDEFINED_ABSOLUTE_FONT_SIZE
@ PREDEFINED_ABSOLUTE_FONT_SIZE
If the type of CRFontSize is PREDEFINED_ABSOLUTE_FONT_SIZE, the CRFontSize::value....
Definition: cr-fonts.h:125
cr_font_family_new
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
FONT_WEIGHT_400
@ FONT_WEIGHT_400
Definition: cr-fonts.h:201
cr_font_style_to_string
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
CRFontFamilyType
CRFontFamilyType
Definition: cr-fonts.h:40
INHERITED_FONT_SIZE
@ 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
FONT_WEIGHT_200
@ FONT_WEIGHT_200
Definition: cr-fonts.h:199
_CRFontFamily::prev
CRFontFamily * prev
Definition: cr-fonts.h:67
FONT_VARIANT_INHERIT
@ FONT_VARIANT_INHERIT
Definition: cr-fonts.h:189
_CRFontSize::absolute
CRNum absolute
Definition: cr-fonts.h:160
FONT_WEIGHT_700
@ FONT_WEIGHT_700
Definition: cr-fonts.h:204
cr_font_size_is_set_to_inherit
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
_CRFontSizeAdjust::num
CRNum * num
Definition: cr-fonts.h:174
FONT_SIZE_ADJUST_NONE
@ FONT_SIZE_ADJUST_NONE
Definition: cr-fonts.h:166
NB_FONT_SIZE_TYPE
@ NB_FONT_SIZE_TYPE
Definition: cr-fonts.h:151
cr_font_weight_to_string
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
FONT_STRETCH_ULTRA_CONDENSED
@ FONT_STRETCH_ULTRA_CONDENSED
Definition: cr-fonts.h:216
FONT_SIZE_INHERIT
@ FONT_SIZE_INHERIT
Definition: cr-fonts.h:91
cr_font_size_set_to_inherit
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
NB_FONT_FAMILIE_TYPES
@ NB_FONT_FAMILIE_TYPES
Definition: cr-fonts.h:50
cr_font_size_get_smaller_predefined_font_size
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
FONT_WEIGHT_NORMAL
@ FONT_WEIGHT_NORMAL
Definition: cr-fonts.h:194
FONT_FAMILY_MONOSPACE
@ FONT_FAMILY_MONOSPACE
Definition: cr-fonts.h:46
FONT_VARIANT_NORMAL
@ FONT_VARIANT_NORMAL
Definition: cr-fonts.h:187
cr_font_family_append
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
cr_font_family_set_name
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
FONT_FAMILY_FANTASY
@ FONT_FAMILY_FANTASY
Definition: cr-fonts.h:45
FONT_WEIGHT_100
@ FONT_WEIGHT_100
Definition: cr-fonts.h:198
FONT_STYLE_OBLIQUE
@ FONT_STYLE_OBLIQUE
Definition: cr-fonts.h:181
NB_PREDEFINED_ABSOLUTE_FONT_SIZES
@ NB_PREDEFINED_ABSOLUTE_FONT_SIZES
Definition: cr-fonts.h:92
FONT_WEIGHT_300
@ FONT_WEIGHT_300
Definition: cr-fonts.h:200
FONT_STRETCH_EXTRA_CONDENSED
@ FONT_STRETCH_EXTRA_CONDENSED
Definition: cr-fonts.h:217
FONT_SIZE_XX_LARGE
@ FONT_SIZE_XX_LARGE
Definition: cr-fonts.h:90
CRFontWeight
CRFontWeight
Definition: cr-fonts.h:192
FONT_WEIGHT_INHERIT
@ FONT_WEIGHT_INHERIT
Definition: cr-fonts.h:207
FONT_SIZE_ADJUST_NUMBER
@ FONT_SIZE_ADJUST_NUMBER
Definition: cr-fonts.h:167
cr_font_family_prepend
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
cr_font_size_adjust_destroy
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
FONT_STRETCH_WIDER
@ FONT_STRETCH_WIDER
Definition: cr-fonts.h:214
CRFontSizeAdjustType
CRFontSizeAdjustType
Definition: cr-fonts.h:164
FONT_STYLE_NORMAL
@ FONT_STYLE_NORMAL
Definition: cr-fonts.h:179
cr_font_size_destroy
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
_CRNum
An abstraction of a number (num) as defined in the css2 spec.
Definition: cr-num.h:90
cr_font_size_copy
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
_CRFontFamily::type
enum CRFontFamilyType type
Definition: cr-fonts.h:57
FONT_STRETCH_EXTRA_EXPANDED
@ FONT_STRETCH_EXTRA_EXPANDED
Definition: cr-fonts.h:222
_CRFontFamily::next
CRFontFamily * next
Definition: cr-fonts.h:66
CRFontStretch
CRFontStretch
Definition: cr-fonts.h:211
FONT_WEIGHT_900
@ FONT_WEIGHT_900
Definition: cr-fonts.h:206
FONT_STYLE_INHERIT
@ FONT_STYLE_INHERIT
Definition: cr-fonts.h:182
FONT_STRETCH_NARROWER
@ FONT_STRETCH_NARROWER
Definition: cr-fonts.h:215
CRFontVariant
CRFontVariant
Definition: cr-fonts.h:185
cr_font_size_new
CRFontSize * cr_font_size_new(void)
cr_font_size_new:
Definition: cr-fonts.c:335
cr_font_size_set_predefined_absolute_font_size
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
cr_font_size_set_absolute_font_size
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
FONT_STRETCH_EXPANDED
@ FONT_STRETCH_EXPANDED
Definition: cr-fonts.h:221
FONT_WEIGHT_BOLDER
@ FONT_WEIGHT_BOLDER
Definition: cr-fonts.h:196
FONT_SIZE_LARGER
@ FONT_SIZE_LARGER
Definition: cr-fonts.h:108
cr_font_size_clear
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
_CRFontSize::value
union _CRFontSize::@0 value
cr-num.h
FONT_STRETCH_SEMI_CONDENSED
@ FONT_STRETCH_SEMI_CONDENSED
Definition: cr-fonts.h:219
cr_font_size_set_relative_font_size
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
NB_RELATIVE_FONT_SIZE
@ NB_RELATIVE_FONT_SIZE
Definition: cr-fonts.h:110
FONT_STRETCH_SEMI_EXPANDED
@ FONT_STRETCH_SEMI_EXPANDED
Definition: cr-fonts.h:220
FONT_FAMILY_INHERIT
@ FONT_FAMILY_INHERIT
Definition: cr-fonts.h:48
cr_font_size_get_larger_predefined_font_size
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
FONT_SIZE_MEDIUM
@ FONT_SIZE_MEDIUM
Definition: cr-fonts.h:87
FONT_SIZE_ADJUST_INHERIT
@ FONT_SIZE_ADJUST_INHERIT
Definition: cr-fonts.h:168
FONT_SIZE_XX_SMALL
@ FONT_SIZE_XX_SMALL
Definition: cr-fonts.h:84
cr_font_stretch_to_string
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
FONT_WEIGHT_600
@ FONT_WEIGHT_600
Definition: cr-fonts.h:203
FONT_WEIGHT_LIGHTER
@ FONT_WEIGHT_LIGHTER
Definition: cr-fonts.h:197
FONT_WEIGHT_800
@ FONT_WEIGHT_800
Definition: cr-fonts.h:205
CRNumType
CRNumType
The different types of numbers.
Definition: cr-num.h:54
_CRFontSizeAdjust
Definition: cr-fonts.h:171
_CRFontFamily::name
guchar * name
Definition: cr-fonts.h:64
FONT_STYLE_ITALIC
@ FONT_STYLE_ITALIC
Definition: cr-fonts.h:180
cr_font_size_adjust_new
CRFontSizeAdjust * cr_font_size_adjust_new(void)
cr_font_size_adjust_new:
Definition: cr-fonts.c:921
FONT_STRETCH_ULTRA_EXPANDED
@ FONT_STRETCH_ULTRA_EXPANDED
Definition: cr-fonts.h:223
CRStatus
CRStatus
The status type returned by the methods of the croco library.
Definition: cr-utils.h:43
cr_font_size_adjust_to_string
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
FONT_FAMILY_NON_GENERIC
@ FONT_FAMILY_NON_GENERIC
Definition: cr-fonts.h:47
cr-utils.h
cr_font_weight_get_bolder
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
CRRelativeFontSize
CRRelativeFontSize
The different types of relative font size.
Definition: cr-fonts.h:106
cr_font_family_to_string
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
_CRFontSizeAdjust::type
enum CRFontSizeAdjustType type
Definition: cr-fonts.h:173
_CRFontSize::predefined
enum CRPredefinedAbsoluteFontSize predefined
Definition: cr-fonts.h:158
RELATIVE_FONT_SIZE
@ 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
FONT_STRETCH_INHERIT
@ FONT_STRETCH_INHERIT
Definition: cr-fonts.h:224
FONT_VARIANT_SMALL_CAPS
@ FONT_VARIANT_SMALL_CAPS
Definition: cr-fonts.h:188
FONT_SIZE_SMALL
@ FONT_SIZE_SMALL
Definition: cr-fonts.h:86
FONT_SIZE_X_SMALL
@ FONT_SIZE_X_SMALL
Definition: cr-fonts.h:85
FONT_SIZE_LARGE
@ FONT_SIZE_LARGE
Definition: cr-fonts.h:88
NB_FONT_WEIGHTS
@ NB_FONT_WEIGHTS
Definition: cr-fonts.h:208
FONT_FAMILY_SERIF
@ FONT_FAMILY_SERIF
Definition: cr-fonts.h:43
FONT_WEIGHT_500
@ FONT_WEIGHT_500
Definition: cr-fonts.h:202
_CRFontSize::relative
enum CRRelativeFontSize relative
Definition: cr-fonts.h:159
FONT_STRETCH_CONDENSED
@ FONT_STRETCH_CONDENSED
Definition: cr-fonts.h:218
CRFontStyle
CRFontStyle
Definition: cr-fonts.h:177
_CRFontFamily
Definition: cr-fonts.h:55
ABSOLUTE_FONT_SIZE
@ 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
CRFontSizeType
CRFontSizeType
The type of font-size property.
Definition: cr-fonts.h:118
_CRFontSize
Definition: cr-fonts.h:155
cr_font_variant_to_string
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