cr-fonts.h

Go to the documentation of this file.
00001 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
00002 
00003 /*
00004  * This file is part of The Croco Library
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of version 2.1 of 
00008  * the GNU Lesser General Public
00009  * License as published by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the 
00017  * GNU Lesser General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020  * USA
00021  *
00022  * Author: Dodji Seketeli
00023  * See COPYRIGHTS file for copyright information.
00024  */
00025 
00026 #ifndef __CR_FONTS_H__
00027 #define __CR_FONTS_H__
00028 #endif
00029 
00030 #include "cr-utils.h"
00031 #include "cr-num.h"
00032 
00033 /**
00034  *@file
00035  *Various type declarations about font selection related
00036  *properties.
00037  */
00038 G_BEGIN_DECLS
00039 
00040 
00041 enum CRFontFamilyType
00042 {
00043         FONT_FAMILY_SANS_SERIF,
00044         FONT_FAMILY_SERIF,      
00045         FONT_FAMILY_CURSIVE,
00046         FONT_FAMILY_FANTASY,
00047         FONT_FAMILY_MONOSPACE,
00048         FONT_FAMILY_NON_GENERIC,
00049         FONT_FAMILY_INHERIT,
00050         /**/
00051         NB_FONT_FAMILIE_TYPES
00052 } ;
00053 
00054 typedef struct _CRFontFamily CRFontFamily ;
00055 
00056 struct _CRFontFamily
00057 {
00058         enum CRFontFamilyType type ;
00059 
00060         /*
00061          *The name of the font family, in case
00062          *it is non generic.
00063          *Is set only if the type is FONT_FAMILY_NON_GENERIC.
00064          */
00065         guchar *name ;
00066 
00067         CRFontFamily *next ;
00068         CRFontFamily *prev ;
00069 } ;
00070 
00071 
00072 /**
00073  *The different types
00074  *of absolute font size.
00075  *This is used by the 'font-size'
00076  *property defined in css2 spec
00077  *in chapter 15.2.4 .
00078  *These values a indexes of 
00079  *table of size so please, do not
00080  *change their definition order unless
00081  *you know what you are doing.
00082  */
00083 enum CRPredefinedAbsoluteFontSize
00084 {
00085         FONT_SIZE_XX_SMALL=0,
00086         FONT_SIZE_X_SMALL,
00087         FONT_SIZE_SMALL,
00088         FONT_SIZE_MEDIUM,
00089         FONT_SIZE_LARGE,
00090         FONT_SIZE_X_LARGE,
00091         FONT_SIZE_XX_LARGE,
00092         FONT_SIZE_INHERIT,
00093         NB_PREDEFINED_ABSOLUTE_FONT_SIZES
00094 } ;
00095 
00096 /**
00097  *The different types
00098  *of relative font size.
00099  *This is used by the 'font-size'
00100  *property defined in css2 spec
00101  *in chapter 15.2.4 .
00102  *These values a indexes of 
00103  *table of size so please, do not
00104  *change their definition order unless
00105  *you know what you are doing.
00106  */
00107 enum CRRelativeFontSize
00108 {        
00109         FONT_SIZE_LARGER,
00110         FONT_SIZE_SMALLER,
00111         NB_RELATIVE_FONT_SIZE
00112 } ;
00113 
00114 /**
00115  *The type of font-size property.
00116  *Used to define the type of #CRFontSize .
00117  *See css2 spec chapter 15.2.4 to understand.
00118  */
00119 enum CRFontSizeType {
00120         /**
00121          *If the type of #CRFontSize is
00122          *PREDEFINED_ABSOLUTE_FONT_SIZE,
00123          *the CRFontSize::value.predefined_absolute 
00124          *field will be defined.
00125          */
00126         PREDEFINED_ABSOLUTE_FONT_SIZE,
00127         
00128         /**
00129          *If the type of #CRFontSize is
00130          *ABSOLUTE_FONT_SIZE,
00131          *the CRFontSize::value.absolute 
00132          *field will be defined.
00133          */
00134         ABSOLUTE_FONT_SIZE,
00135 
00136         /**
00137          *If the type of #CRFontSize is
00138          *RELATIVE_FONT_SIZE,
00139          *the CRFontSize::value.relative
00140          *field will be defined.
00141          */
00142         RELATIVE_FONT_SIZE,
00143 
00144         /**
00145          *If the type of #CRFontSize is
00146          *INHERITED_FONT_SIZE,
00147          *the None of the field of the CRFontSize::value enum
00148          *will be defined.
00149          */
00150         INHERITED_FONT_SIZE,
00151 
00152         NB_FONT_SIZE_TYPE
00153 } ;
00154 
00155 typedef struct _CRFontSize CRFontSize ;
00156 struct _CRFontSize {
00157         enum CRFontSizeType type ;
00158         union  {
00159                 enum CRPredefinedAbsoluteFontSize predefined ;
00160                 enum CRRelativeFontSize relative ;
00161                 CRNum absolute ;
00162         } value;
00163 } ;
00164 
00165 enum CRFontSizeAdjustType
00166 {
00167         FONT_SIZE_ADJUST_NONE = 0,
00168         FONT_SIZE_ADJUST_NUMBER,
00169         FONT_SIZE_ADJUST_INHERIT
00170 } ;
00171 typedef struct _CRFontSizeAdjust CRFontSizeAdjust ;
00172 struct _CRFontSizeAdjust
00173 {
00174         enum CRFontSizeAdjustType type ;
00175         CRNum *num ;
00176 } ;
00177 
00178 enum CRFontStyle
00179 {
00180         FONT_STYLE_NORMAL=0,
00181         FONT_STYLE_ITALIC,
00182         FONT_STYLE_OBLIQUE,
00183         FONT_STYLE_INHERIT
00184 } ;
00185 
00186 enum CRFontVariant
00187 {
00188         FONT_VARIANT_NORMAL=0,
00189         FONT_VARIANT_SMALL_CAPS,
00190         FONT_VARIANT_INHERIT
00191 } ;
00192 
00193 enum CRFontWeight
00194 {
00195         FONT_WEIGHT_NORMAL = 1,
00196         FONT_WEIGHT_BOLD = 1<<1,
00197         FONT_WEIGHT_BOLDER = 1<<2,
00198         FONT_WEIGHT_LIGHTER = 1<<3,
00199         FONT_WEIGHT_100 = 1<<4,
00200         FONT_WEIGHT_200 = 1<<5,
00201         FONT_WEIGHT_300 = 1<<6,
00202         FONT_WEIGHT_400 = 1<<7,
00203         FONT_WEIGHT_500 = 1<<8,
00204         FONT_WEIGHT_600 = 1<<9,
00205         FONT_WEIGHT_700 = 1<<10,
00206         FONT_WEIGHT_800 = 1<<11,
00207         FONT_WEIGHT_900 = 1<<12,
00208         FONT_WEIGHT_INHERIT = 1<<13,
00209         NB_FONT_WEIGHTS
00210 } ;
00211 
00212 enum CRFontStretch
00213 {
00214         FONT_STRETCH_NORMAL=0,
00215         FONT_STRETCH_WIDER,
00216         FONT_STRETCH_NARROWER,
00217         FONT_STRETCH_ULTRA_CONDENSED,
00218         FONT_STRETCH_EXTRA_CONDENSED,
00219         FONT_STRETCH_CONDENSED,
00220         FONT_STRETCH_SEMI_CONDENSED,
00221         FONT_STRETCH_SEMI_EXPANDED,
00222         FONT_STRETCH_EXPANDED,
00223         FONT_STRETCH_EXTRA_EXPANDED,
00224         FONT_STRETCH_ULTRA_EXPANDED,
00225         FONT_STRETCH_INHERIT
00226 } ;
00227 
00228 /**************************************
00229  *'font-family' manipulation functions
00230  ***************************************/
00231 CRFontFamily *
00232 cr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name) ;
00233 
00234 CRFontFamily *
00235 cr_font_family_append (CRFontFamily *a_this, 
00236                        CRFontFamily *a_family_to_append) ;
00237 
00238 guchar *
00239 cr_font_family_to_string (CRFontFamily *a_this,
00240                           gboolean a_walk_font_family_list) ;
00241 
00242 CRFontFamily *
00243 cr_font_family_prepend (CRFontFamily *a_this, 
00244                         CRFontFamily *a_family_to_prepend);
00245 
00246 enum CRStatus
00247 cr_font_family_destroy (CRFontFamily *a_this) ;
00248 
00249 enum CRStatus
00250 cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name) ;
00251 
00252 
00253 /************************************
00254  *'font-size' manipulation functions
00255  ***********************************/
00256 
00257 CRFontSize * cr_font_size_new (void) ;
00258 
00259 enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
00260 
00261 enum CRStatus cr_font_size_copy (CRFontSize *a_dst, 
00262                                  CRFontSize *a_src) ;
00263 enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, 
00264                                                               enum CRPredefinedAbsoluteFontSize a_predefined) ;
00265 enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this,
00266                                                    enum CRRelativeFontSize a_relative) ;
00267 
00268 enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this,
00269                                                    enum CRNumType a_num_type,
00270                                                    gdouble a_value) ;
00271 
00272 enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
00273 
00274 gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
00275 
00276 gchar* cr_font_size_to_string (CRFontSize *a_this) ;
00277 
00278 void cr_font_size_destroy (CRFontSize *a_font_size) ;
00279 
00280 /*******************************************************
00281  *'font-size-adjust' manipulation function declarations
00282  *******************************************************/
00283 
00284 CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
00285 
00286 gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
00287 
00288 void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
00289 
00290 void 
00291 cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
00292                                                enum CRPredefinedAbsoluteFontSize *a_smaller_size) ;
00293 void
00294 cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
00295                                               enum CRPredefinedAbsoluteFontSize *a_larger_size) ;
00296 
00297 gboolean
00298 cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) ;
00299 
00300 /***********************************
00301  *various other font related functions
00302  ***********************************/
00303 const gchar * cr_font_style_to_string (enum CRFontStyle a_code) ;
00304 
00305 const gchar * cr_font_weight_to_string (enum CRFontWeight a_code)  ;
00306 
00307 enum CRFontWeight
00308 cr_font_weight_get_bolder (enum CRFontWeight a_weight) ;
00309 
00310 const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ;
00311 
00312 const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
00313 
00314 G_END_DECLS

Generated on Wed Mar 15 18:23:54 2006 for Libcroco by  doxygen 1.4.6