1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
4 * This file is part of The Croco Library
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.
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.
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
22 * Author: Dodji Seketeli
23 * See COPYRIGHTS file for copyright information.
26 #ifndef __CR_FONTS_H__
27 #define __CR_FONTS_H__
34 *Various type declarations about font selection related
42 FONT_FAMILY_SANS_SERIF,
46 FONT_FAMILY_MONOSPACE,
47 FONT_FAMILY_NON_GENERIC,
53 typedef struct _CRFontFamily CRFontFamily ;
57 enum CRFontFamilyType type ;
60 *The name of the font family, in case
62 *Is set only if the type is FONT_FAMILY_NON_GENERIC.
73 *of absolute font size.
74 *This is used by the 'font-size'
75 *property defined in css2 spec
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.
82 enum CRPredefinedAbsoluteFontSize
92 NB_PREDEFINED_ABSOLUTE_FONT_SIZES
97 *of relative font size.
98 *This is used by the 'font-size'
99 *property defined in css2 spec
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.
106 enum CRRelativeFontSize
110 NB_RELATIVE_FONT_SIZE
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.
118 enum CRFontSizeType {
120 *If the type of #CRFontSize is
121 *PREDEFINED_ABSOLUTE_FONT_SIZE,
122 *the CRFontSize::value.predefined_absolute
123 *field will be defined.
125 PREDEFINED_ABSOLUTE_FONT_SIZE,
128 *If the type of #CRFontSize is
130 *the CRFontSize::value.absolute
131 *field will be defined.
136 *If the type of #CRFontSize is
138 *the CRFontSize::value.relative
139 *field will be defined.
144 *If the type of #CRFontSize is
145 *INHERITED_FONT_SIZE,
146 *the None of the field of the CRFontSize::value enum
154 typedef struct _CRFontSize CRFontSize ;
156 enum CRFontSizeType type ;
158 enum CRPredefinedAbsoluteFontSize predefined ;
159 enum CRRelativeFontSize relative ;
164 enum CRFontSizeAdjustType
166 FONT_SIZE_ADJUST_NONE = 0,
167 FONT_SIZE_ADJUST_NUMBER,
168 FONT_SIZE_ADJUST_INHERIT
170 typedef struct _CRFontSizeAdjust CRFontSizeAdjust ;
171 struct _CRFontSizeAdjust
173 enum CRFontSizeAdjustType type ;
187 FONT_VARIANT_NORMAL=0,
188 FONT_VARIANT_SMALL_CAPS,
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,
213 FONT_STRETCH_NORMAL=0,
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,
227 /**************************************
228 *'font-family' manipulation functions
229 ***************************************/
231 cr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name) ;
234 cr_font_family_append (CRFontFamily *a_this,
235 CRFontFamily *a_family_to_append) ;
238 cr_font_family_to_string (CRFontFamily *a_this,
239 gboolean a_walk_font_family_list) ;
242 cr_font_family_prepend (CRFontFamily *a_this,
243 CRFontFamily *a_family_to_prepend);
246 cr_font_family_destroy (CRFontFamily *a_this) ;
249 cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name) ;
252 /************************************
253 *'font-size' manipulation functions
254 ***********************************/
256 CRFontSize * cr_font_size_new (void) ;
258 enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
260 enum CRStatus cr_font_size_copy (CRFontSize *a_dst,
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) ;
267 enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this,
268 enum CRNumType a_num_type,
271 enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
273 gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
275 gchar* cr_font_size_to_string (CRFontSize *a_this) ;
277 void cr_font_size_destroy (CRFontSize *a_font_size) ;
279 /*******************************************************
280 *'font-size-adjust' manipulation function declarations
281 *******************************************************/
283 CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
285 gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
287 void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
290 cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
291 enum CRPredefinedAbsoluteFontSize *a_smaller_size) ;
293 cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
294 enum CRPredefinedAbsoluteFontSize *a_larger_size) ;
297 cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) ;
299 /***********************************
300 *various other font related functions
301 ***********************************/
302 const gchar * cr_font_style_to_string (enum CRFontStyle a_code) ;
304 const gchar * cr_font_weight_to_string (enum CRFontWeight a_code) ;
307 cr_font_weight_get_bolder (enum CRFontWeight a_weight) ;
309 const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ;
311 const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
315 #endif /* __CR_FONTS_H__ */