diff options
author | Dodji Seketeli <dodji@src.gnome.org> | 2003-05-28 23:43:24 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@src.gnome.org> | 2003-05-28 23:43:24 +0000 |
commit | d49926a0dcf83096619e5201a083787c9caf817e (patch) | |
tree | 61dd8ce0a29dea5e9cd507d06a6775a67a372b2f | |
parent | a83839af64b7db360926551aa4fb617b8a8cf1c6 (diff) | |
download | libcroco-d49926a0dcf83096619e5201a083787c9caf817e.tar.gz |
The very trivial fonts related declaration/definitions.
Dodji.
-rw-r--r-- | src/seleng/cr-fonts.c | 66 | ||||
-rw-r--r-- | src/seleng/cr-fonts.h | 185 | ||||
-rw-r--r-- | src/seleng/cr-style.h | 18 |
3 files changed, 265 insertions, 4 deletions
diff --git a/src/seleng/cr-fonts.c b/src/seleng/cr-fonts.c index 90a1868..c7ff624 100644 --- a/src/seleng/cr-fonts.c +++ b/src/seleng/cr-fonts.c @@ -147,3 +147,69 @@ cr_font_family_destroy (CRFontFamily *a_this) return CR_OK ; } +/*************************************************** + *'font-size' manipulation functions definitions + ***************************************************/ + +CRFontSize * +cr_font_size_new (void) +{ + CRFontSize *result = NULL ; + + result = g_try_malloc (sizeof (CRFontSize)) ; + if (!result) + { + cr_utils_trace_info ("Out of memory") ; + return NULL ; + } + memset (result, 0, sizeof (CRFontSize)) ; + + return result ; +} + + +void +cr_font_size_destroy (CRFontSize *a_font_size) +{ + g_return_if_fail (a_font_size) ; + + if (a_font_size->type == ABSOLUTE_FONT_SIZE + && a_font_size->value.absolute) + { + cr_num_destroy (a_font_size->value.absolute) ; + a_font_size->value.absolute = NULL ; + } +} + +/******************************************************* + *'font-size-adjust' manipulation function definition + *******************************************************/ + +CRFontSizeAdjust * +cr_font_size_adjust_new (void) +{ + CRFontSizeAdjust *result = NULL ; + + result = g_try_malloc (sizeof (CRFontSizeAdjust)) ; + if (!result) + { + cr_utils_trace_info ("Out of memory") ; + return NULL ; + } + memset (result, 0, sizeof (CRFontSizeAdjust)) ; + + return result ; +} + +void +cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) +{ + g_return_if_fail (a_this) ; + + if (a_this->type == FONT_SIZE_ADJUST_NUMBER + && a_this->num) + { + cr_num_destroy (a_this->num) ; + a_this->num = NULL ; + } +} diff --git a/src/seleng/cr-fonts.h b/src/seleng/cr-fonts.h index 182366a..744bf55 100644 --- a/src/seleng/cr-fonts.h +++ b/src/seleng/cr-fonts.h @@ -26,9 +26,16 @@ #endif #include "cr-utils.h" +#include "cr-num.h" +/** + *@file + *Various type declarations about font selection related + *properties. + */ G_BEGIN_DECLS + enum CRFontFamilyType { FONT_FAMILY_SANS_SERIF, @@ -58,6 +65,163 @@ struct _CRFontFamily CRFontFamily *prev ; } ; + +/** + *The different types + *of absolute font size. + *This is used by the 'font-size' + *property defined in css2 spec + *in chapter 15.2.4 . + *These values a indexes of + *table of size so please, do not + *change their definition order unless + *you know what you are doing. + */ +enum CRPredefinedAbsoluteFontSize +{ + XX_SMALL_FONT_SIZE=0, + X_SMALL_FONT_SIZE, + SMALL_FONT_SIZE, + MEDIUM_FONT_SIZE, + LARGE_FONT_SIZE, + X_LARGE_FONT_SIZE, + XX_LARGE_FONT_SIZE +} ; + +/** + *The different types + *of relative font size. + *This is used by the 'font-size' + *property defined in css2 spec + *in chapter 15.2.4 . + *These values a indexes of + *table of size so please, do not + *change their definition order unless + *you know what you are doing. + */ +enum CRRelativeFontSize +{ + LARGER_FONT_SIZE, + SMALLER_FONT_SIZE +} ; + +/** + *The type of font-size property. + *Used to define the type of #CRFontSize . + *See css2 spec chapter 15.2.4 to understand. + */ +enum CRFontSizeType +{ + /** + *If the type of #CRFontSize is + *PREDEFINED_ABSOLUTE_FONT_SIZE, + *the CRFontSize::value.predefined_absolute + *field will be defined. + */ + PREDEFINED_ABSOLUTE_FONT_SIZE, + + /** + *If the type of #CRFontSize is + *ABSOLUTE_FONT_SIZE, + *the CRFontSize::value.absolute + *field will be defined. + */ + ABSOLUTE_FONT_SIZE, + + /** + *If the type of #CRFontSize is + *RELATIVE_FONT_SIZE, + *the CRFontSize::value.relative + *field will be defined. + */ + RELATIVE_FONT_SIZE, + + /** + *If the type of #CRFontSize is + *INHERITED_FONT_SIZE, + *the None of the field of the CRFontSize::value enum + *will be defined. + */ + INHERITED_FONT_SIZE +} ; + +typedef struct _CRFontSize CRFontSize ; +struct _CRFontSize +{ + enum CRFontSizeType type ; + union + { + enum CRPredefinedAbsoluteFontSize predefine_absolute ; + enum CRRelativeFontSize relative ; + CRNum * absolute ; + } value; +} ; + +enum CRFontSizeAdjustType +{ + FONT_SIZE_ADJUST_NONE = 0, + FONT_SIZE_ADJUST_NUMBER, + FONT_SIZE_ADJUST_INHERIT +} ; +typedef struct _CRFontSizeAdjust CRFontSizeAdjust ; +struct _CRFontSizeAdjust +{ + enum CRFontSizeAdjustType type ; + CRNum *num ; +} ; + +enum CRFontStyle +{ + FONT_STYLE_NORMAL=0, + FONT_STYLE_ITALIC, + FONT_STYLE_OBLIQUE, + FONT_STYLE_INHERIT +} ; + +enum CRFontVariant +{ + FONT_VARIANT_NORMAL=0, + FONT_VARIANT_SMALL_CAPS, + FONT_VARIANT_INHERIT +} ; + +enum CRFontWeight +{ + FONT_WEIGHT_NORMAL=0, + FONT_WEIGHT_BOLD, + FONT_WEIGHT_BOLDER, + FONT_WEIGHT_LIGHTER, + FONT_WEIGHT_100, + FONT_WEIGHT_200, + FONT_WEIGHT_300, + FONT_WEIGHT_400, + FONT_WEIGHT_500, + FONT_WEIGHT_600, + FONT_WEIGHT_700, + FONT_WEIGHT_800, + FONT_WEIGHT_900, + FONT_WEIGHT_INHERIT, +} ; + +enum CRFontStretch +{ + FONT_STRETCH_NORMAL=0, + FONT_STRETCH_WIDER, + FONT_STRETCH_NARROWER, + FONT_STRETCH_ULTRA_CONDENSED, + FONT_STRETCH_EXTRA_CONDENSED, + FONT_STRETCH_CONDENSED, + FONT_STRETCH_SEMI_CONDENSED, + FONT_STRETCH_SEMI_EXPANDED, + FONT_STRETCH_EXPANDED, + FONT_STRETCH_EXTRA_EXPANDED, + FONT_STRETCH_ULTRA_EXPANDED, + FONT_STRETCH_INHERIT +} ; + +/************************************** + *'font-family' manipulation functions + ***************************************/ CRFontFamily * cr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name) ; @@ -75,4 +239,25 @@ cr_font_family_destroy (CRFontFamily *a_this) ; enum CRStatus cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name) ; + +/************************************ + *'font-size' manipulation functions + ***********************************/ + +CRFontSize * +cr_font_size_new (void) ; + +void +cr_font_size_destroy (CRFontSize *a_font_size) ; + +/******************************************************* + *'font-size-adjust' manipulation function declarations + *******************************************************/ + +CRFontSizeAdjust * +cr_font_size_adjust_new (void) ; + +void +cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ; + G_END_DECLS diff --git a/src/seleng/cr-style.h b/src/seleng/cr-style.h index 700228b..9265300 100644 --- a/src/seleng/cr-style.h +++ b/src/seleng/cr-style.h @@ -199,6 +199,9 @@ enum CRBoxOffsetProp NB_BOX_OFFSET_PROPS } ; + + + /** *The css2 style class. *Contains computed and actual values @@ -237,13 +240,20 @@ struct _CRStyle enum CRFloatType float_type ; /* - *the font-family property - *A list of null terminated instance of - *guchar* each element of the list is - *the name of a font family. + *the 'font-family' property. */ CRFontFamily *font_family ; + /** + *the 'font-size' property. + */ + CRFontSize *font_size ; + CRFontSizeAdjust *font_size_adjust ; + enum CRFontStyle font_style ; + enum CRFontVariant font_variant ; + enum CRFontWeight font_weight ; + enum CRFontStretch font_stretch ; + CRStyle *parent_style ; gulong ref_count ; } ; |