Libcroco
Data Structures | Typedefs | Enumerations | Functions
cr-fonts.h File Reference

Various type declarations about font selection related properties. More...

#include "cr-utils.h"
#include "cr-num.h"

Go to the source code of this file.

Data Structures

struct  _CRFontFamily
struct  _CRFontSize
struct  _CRFontSizeAdjust

Typedefs

typedef struct _CRFontFamily CRFontFamily
typedef struct _CRFontSize CRFontSize
typedef struct _CRFontSizeAdjust CRFontSizeAdjust

Enumerations

enum  CRFontFamilyType {
  FONT_FAMILY_SANS_SERIF, FONT_FAMILY_SERIF, FONT_FAMILY_CURSIVE, FONT_FAMILY_FANTASY,
  FONT_FAMILY_MONOSPACE, FONT_FAMILY_NON_GENERIC, FONT_FAMILY_INHERIT, NB_FONT_FAMILIE_TYPES
}
enum  CRPredefinedAbsoluteFontSize {
  FONT_SIZE_XX_SMALL = 0, FONT_SIZE_X_SMALL, FONT_SIZE_SMALL, FONT_SIZE_MEDIUM,
  FONT_SIZE_LARGE, FONT_SIZE_X_LARGE, FONT_SIZE_XX_LARGE, FONT_SIZE_INHERIT,
  NB_PREDEFINED_ABSOLUTE_FONT_SIZES
}
 The different types of absolute font size. More...
enum  CRRelativeFontSize { FONT_SIZE_LARGER, FONT_SIZE_SMALLER, NB_RELATIVE_FONT_SIZE }
 The different types of relative font size. More...
enum  CRFontSizeType {
  PREDEFINED_ABSOLUTE_FONT_SIZE, ABSOLUTE_FONT_SIZE, RELATIVE_FONT_SIZE, INHERITED_FONT_SIZE,
  NB_FONT_SIZE_TYPE
}
 The type of font-size property. More...
enum  CRFontSizeAdjustType { FONT_SIZE_ADJUST_NONE = 0, FONT_SIZE_ADJUST_NUMBER, FONT_SIZE_ADJUST_INHERIT }
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 = 1, FONT_WEIGHT_BOLD = 1<<1, FONT_WEIGHT_BOLDER = 1<<2, FONT_WEIGHT_LIGHTER = 1<<3,
  FONT_WEIGHT_100 = 1<<4, FONT_WEIGHT_200 = 1<<5, FONT_WEIGHT_300 = 1<<6, FONT_WEIGHT_400 = 1<<7,
  FONT_WEIGHT_500 = 1<<8, FONT_WEIGHT_600 = 1<<9, FONT_WEIGHT_700 = 1<<10, FONT_WEIGHT_800 = 1<<11,
  FONT_WEIGHT_900 = 1<<12, FONT_WEIGHT_INHERIT = 1<<13, NB_FONT_WEIGHTS
}
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
}

Functions

CRFontFamilycr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name)
 cr_font_family_new: : the type of font family to create.
CRFontFamilycr_font_family_append (CRFontFamily *a_this, CRFontFamily *a_family_to_append)
 cr_font_family_append: : the current instance of CRFontFamily.
guchar * cr_font_family_to_string (CRFontFamily const *a_this, gboolean a_walk_font_family_list)
 cr_font_family_to_string: : the current instance of CRFontFamily.
CRFontFamilycr_font_family_prepend (CRFontFamily *a_this, CRFontFamily *a_family_to_prepend)
 cr_font_family_prepend: : the current instance CRFontFamily.
enum CRStatus cr_font_family_destroy (CRFontFamily *a_this)
 cr_font_family_destroy: : the current instance of CRFontFamily.
enum CRStatus cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name)
 cr_font_family_set_name: : the current instance of CRFontFamily.
CRFontSizecr_font_size_new (void)
 cr_font_size_new:
enum CRStatus cr_font_size_clear (CRFontSize *a_this)
 cr_font_size_clear: : the current instance of CRFontSize
enum CRStatus cr_font_size_copy (CRFontSize *a_dst, CRFontSize const *a_src)
 cr_font_size_copy: : the destination CRFontSize (where to copy to).
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: : the current instance of CRFontSize.
enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this, enum CRRelativeFontSize a_relative)
 cr_font_size_set_relative_font_size: : the current instance of CRFontSize : the new relative 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: : the current instance of CRFontSize : the type of number to set.
enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this)
 cr_font_size_set_to_inherit: : the current instance of CRFontSize
gboolean cr_font_size_is_set_to_inherit (CRFontSize const *a_this)
 cr_font_size_is_set_to_inherit: : the current instance of CRFontSize.
gchar * cr_font_size_to_string (CRFontSize const *a_this)
 cr_font_size_to_string: : the current instance of CRFontSize
void cr_font_size_destroy (CRFontSize *a_font_size)
 cr_font_size_destroy: : the font size to destroy
CRFontSizeAdjustcr_font_size_adjust_new (void)
 cr_font_size_adjust_new:
gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this)
 cr_font_size_adjust_to_string: : the instance of CRFontSizeAdjust.
void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this)
 cr_font_size_adjust_destroy: : the current instance of CRFontSizeAdjust.
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: : the font size to consider.
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: : the font size to consider.
gboolean cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size)
 cr_font_size_is_predefined_absolute_font_size: : the font size to consider.
const gchar * cr_font_style_to_string (enum CRFontStyle a_code)
 cr_font_style_to_string: : the current instance of CRFontStyle .
const gchar * cr_font_weight_to_string (enum CRFontWeight a_code)
 cr_font_weight_to_string: : the font weight to consider.
enum CRFontWeight cr_font_weight_get_bolder (enum CRFontWeight a_weight)
 cr_font_weight_get_bolder: : the CRFontWeight to consider.
const gchar * cr_font_variant_to_string (enum CRFontVariant a_code)
 cr_font_variant_to_string: : the current instance of CRFontVariant.
const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code)
 cr_font_stretch_to_string: : the instance of CRFontStretch to consider.

Detailed Description

Various type declarations about font selection related properties.

Definition in file cr-fonts.h.


Typedef Documentation

typedef struct _CRFontFamily CRFontFamily

Definition at line 53 of file cr-fonts.h.

typedef struct _CRFontSize CRFontSize

Definition at line 154 of file cr-fonts.h.

Definition at line 170 of file cr-fonts.h.


Enumeration Type Documentation

Enumerator:
FONT_FAMILY_SANS_SERIF 
FONT_FAMILY_SERIF 
FONT_FAMILY_CURSIVE 
FONT_FAMILY_FANTASY 
FONT_FAMILY_MONOSPACE 
FONT_FAMILY_NON_GENERIC 
FONT_FAMILY_INHERIT 
NB_FONT_FAMILIE_TYPES 

Definition at line 40 of file cr-fonts.h.

Enumerator:
FONT_SIZE_ADJUST_NONE 
FONT_SIZE_ADJUST_NUMBER 
FONT_SIZE_ADJUST_INHERIT 

Definition at line 164 of file cr-fonts.h.

The type of font-size property.

Used to define the type of CRFontSize . See css2 spec chapter 15.2.4 to understand.

Enumerator:
PREDEFINED_ABSOLUTE_FONT_SIZE 

If the type of CRFontSize is PREDEFINED_ABSOLUTE_FONT_SIZE, the CRFontSize::value.predefined_absolute field will be defined.

ABSOLUTE_FONT_SIZE 

If the type of CRFontSize is ABSOLUTE_FONT_SIZE, the CRFontSize::value.absolute field will be defined.

RELATIVE_FONT_SIZE 

If the type of CRFontSize is RELATIVE_FONT_SIZE, the CRFontSize::value.relative field will be defined.

INHERITED_FONT_SIZE 

If the type of CRFontSize is INHERITED_FONT_SIZE, the None of the field of the CRFontSize::value enum will be defined.

NB_FONT_SIZE_TYPE 

Definition at line 118 of file cr-fonts.h.

Enumerator:
FONT_STRETCH_NORMAL 
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 

Definition at line 211 of file cr-fonts.h.

Enumerator:
FONT_STYLE_NORMAL 
FONT_STYLE_ITALIC 
FONT_STYLE_OBLIQUE 
FONT_STYLE_INHERIT 

Definition at line 177 of file cr-fonts.h.

Enumerator:
FONT_VARIANT_NORMAL 
FONT_VARIANT_SMALL_CAPS 
FONT_VARIANT_INHERIT 

Definition at line 185 of file cr-fonts.h.

Enumerator:
FONT_WEIGHT_NORMAL 
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 
NB_FONT_WEIGHTS 

Definition at line 192 of file cr-fonts.h.

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.

Enumerator:
FONT_SIZE_XX_SMALL 
FONT_SIZE_X_SMALL 
FONT_SIZE_SMALL 
FONT_SIZE_MEDIUM 
FONT_SIZE_LARGE 
FONT_SIZE_X_LARGE 
FONT_SIZE_XX_LARGE 
FONT_SIZE_INHERIT 
NB_PREDEFINED_ABSOLUTE_FONT_SIZES 

Definition at line 82 of file cr-fonts.h.

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.

Enumerator:
FONT_SIZE_LARGER 
FONT_SIZE_SMALLER 
NB_RELATIVE_FONT_SIZE 

Definition at line 106 of file cr-fonts.h.


Function Documentation

CRFontFamily* cr_font_family_append ( CRFontFamily a_this,
CRFontFamily a_family_to_append 
)

cr_font_family_append: : the current instance of CRFontFamily.

: the font family to append to the list

Returns the new font family list.

Definition at line 250 of file cr-fonts.c.

References _CRFontFamily::next, and _CRFontFamily::prev.

cr_font_family_destroy: : the current instance of CRFontFamily.

Returns CR_OK upon sucessful completion, an error code otherwise.

Definition at line 298 of file cr-fonts.c.

References CR_BAD_PARAM_ERROR, CR_OK, _CRFontFamily::name, _CRFontFamily::next, and _CRFontFamily::prev.

CRFontFamily* cr_font_family_new ( enum CRFontFamilyType  a_type,
guchar *  a_name 
)

cr_font_family_new: : the type of font family to create.

: the name of the font family.

create a font family.

Returns the newly built font family.

Definition at line 154 of file cr-fonts.c.

References cr_font_family_set_name(), cr_utils_trace_info, and _CRFontFamily::type.

CRFontFamily* cr_font_family_prepend ( CRFontFamily a_this,
CRFontFamily a_family_to_prepend 
)

cr_font_family_prepend: : the current instance CRFontFamily.

: the font family to prepend to the list.

Returns the font family list.

Definition at line 277 of file cr-fonts.c.

References _CRFontFamily::next, and _CRFontFamily::prev.

enum CRStatus cr_font_family_set_name ( CRFontFamily a_this,
guchar *  a_name 
)

cr_font_family_set_name: : the current instance of CRFontFamily.

: the new name

Returns CR_OK upon sucessful completion, an error code otherwise.

Definition at line 221 of file cr-fonts.c.

References CR_BAD_PARAM_ERROR, CR_OK, FONT_FAMILY_NON_GENERIC, _CRFontFamily::name, and _CRFontFamily::type.

Referenced by cr_font_family_new().

guchar* cr_font_family_to_string ( CRFontFamily const *  a_this,
gboolean  a_walk_font_family_list 
)

cr_font_family_to_string: : the current instance of CRFontFamily.

: wether the serialize the entire list.

Returns the seriliazed font family. The caller has to free it using g_free().

Definition at line 182 of file cr-fonts.c.

References CR_OK.

Referenced by cr_style_to_string().

cr_font_size_adjust_destroy: : the current instance of CRFontSizeAdjust.

Definition at line 941 of file cr-fonts.c.

References cr_num_destroy(), FONT_SIZE_ADJUST_NUMBER, _CRFontSizeAdjust::num, and _CRFontSizeAdjust::type.

cr_font_size_adjust_new:

Returns a newly built instance of CRFontSizeAdjust

Definition at line 921 of file cr-fonts.c.

References cr_utils_trace_info.

gchar* cr_font_size_adjust_to_string ( CRFontSizeAdjust const *  a_this)

cr_font_size_adjust_to_string: : the instance of CRFontSizeAdjust.

Returns the serialized form of CRFontSizeAdjust

Definition at line 676 of file cr-fonts.c.

References cr_num_to_string(), FONT_SIZE_ADJUST_INHERIT, FONT_SIZE_ADJUST_NONE, FONT_SIZE_ADJUST_NUMBER, _CRFontSizeAdjust::num, and _CRFontSizeAdjust::type.

Referenced by cr_style_to_string().

cr_font_size_clear: : the current instance of CRFontSize

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 356 of file cr-fonts.c.

References ABSOLUTE_FONT_SIZE, CR_BAD_PARAM_ERROR, CR_OK, CR_UNKNOWN_TYPE_ERROR, INHERITED_FONT_SIZE, PREDEFINED_ABSOLUTE_FONT_SIZE, RELATIVE_FONT_SIZE, and _CRFontSize::type.

Referenced by cr_font_size_copy(), cr_font_size_set_to_inherit(), and cr_style_set_props_to_default_values().

enum CRStatus cr_font_size_copy ( CRFontSize a_dst,
CRFontSize const *  a_src 
)

cr_font_size_copy: : the destination CRFontSize (where to copy to).

: the source CRFontSize (where to copy from).

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 386 of file cr-fonts.c.

References _CRFontSize::absolute, ABSOLUTE_FONT_SIZE, CR_BAD_PARAM_ERROR, cr_font_size_clear(), cr_num_copy(), CR_OK, CR_UNKNOWN_TYPE_ERROR, INHERITED_FONT_SIZE, PREDEFINED_ABSOLUTE_FONT_SIZE, RELATIVE_FONT_SIZE, _CRFontSize::type, and _CRFontSize::value.

Referenced by cr_style_resolve_inherited_properties().

void cr_font_size_destroy ( CRFontSize a_font_size)

cr_font_size_destroy: : the font size to destroy

Definition at line 904 of file cr-fonts.c.

cr_font_size_get_larger_predefined_font_size: : the font size to consider.

: out parameter. the font size considered larger than .

Definition at line 607 of file cr-fonts.c.

References cr_utils_trace_info, FONT_SIZE_INHERIT, FONT_SIZE_LARGE, FONT_SIZE_MEDIUM, FONT_SIZE_SMALL, FONT_SIZE_X_LARGE, FONT_SIZE_X_SMALL, FONT_SIZE_XX_LARGE, FONT_SIZE_XX_SMALL, and NB_PREDEFINED_ABSOLUTE_FONT_SIZES.

cr_font_size_get_smaller_predefined: : the font size to consider.

: out parameter. The a smaller value than .

Definition at line 554 of file cr-fonts.c.

References cr_utils_trace_info, FONT_SIZE_INHERIT, FONT_SIZE_LARGE, FONT_SIZE_MEDIUM, FONT_SIZE_SMALL, FONT_SIZE_X_LARGE, FONT_SIZE_X_SMALL, FONT_SIZE_XX_LARGE, FONT_SIZE_XX_SMALL, and NB_PREDEFINED_ABSOLUTE_FONT_SIZES.

cr_font_size_is_predefined_absolute_font_size: : the font size to consider.

Returns TRUE if the instance is an predefined absolute font size, FALSE otherwise.

Definition at line 659 of file cr-fonts.c.

References FONT_SIZE_XX_SMALL, and NB_PREDEFINED_ABSOLUTE_FONT_SIZES.

gboolean cr_font_size_is_set_to_inherit ( CRFontSize const *  a_this)

cr_font_size_is_set_to_inherit: : the current instance of CRFontSize.

Returns TRUE if the current instance is set to 'inherit'.

Definition at line 502 of file cr-fonts.c.

References INHERITED_FONT_SIZE, and _CRFontSize::type.

cr_font_size_new:

Returns the newly created font size.

Definition at line 335 of file cr-fonts.c.

References cr_utils_trace_info.

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: : the current instance of CRFontSize : the type of number to set.

: the actual value to set.

Returns CR_OK upon succesful completion, an error code otherwise.

Definition at line 463 of file cr-fonts.c.

References _CRFontSize::absolute, ABSOLUTE_FONT_SIZE, CR_BAD_PARAM_ERROR, cr_num_set(), CR_OK, NB_NUM_TYPE, NUM_AUTO, _CRFontSize::type, and _CRFontSize::value.

cr_font_size_set_predefined_absolute_font_size: : the current instance of CRFontSize.

: what to set.

Returns CR_OK upon sucessful completion, an error code otherwise.

Definition at line 419 of file cr-fonts.c.

References CR_BAD_PARAM_ERROR, CR_OK, FONT_SIZE_XX_SMALL, NB_PREDEFINED_ABSOLUTE_FONT_SIZES, _CRFontSize::predefined, PREDEFINED_ABSOLUTE_FONT_SIZE, _CRFontSize::type, and _CRFontSize::value.

Referenced by cr_style_set_props_to_initial_values().

cr_font_size_set_relative_font_size: : the current instance of CRFontSize : the new relative font size

Returns CR_OK upon successful completion, an error code otherwise.

Definition at line 441 of file cr-fonts.c.

References CR_BAD_PARAM_ERROR, CR_OK, FONT_SIZE_LARGER, NB_RELATIVE_FONT_SIZE, _CRFontSize::relative, RELATIVE_FONT_SIZE, _CRFontSize::type, and _CRFontSize::value.

cr_font_size_set_to_inherit: : the current instance of CRFontSize

Returns CR_OK upon succesful completion, an error code otherwise.

Definition at line 485 of file cr-fonts.c.

References CR_BAD_PARAM_ERROR, cr_font_size_clear(), CR_OK, INHERITED_FONT_SIZE, and _CRFontSize::type.

Referenced by cr_style_set_props_to_default_values().

gchar* cr_font_size_to_string ( CRFontSize const *  a_this)

cr_font_size_to_string: : the current instance of CRFontSize

Returns the serialized form of CRFontSize. The returned string has to bee freed using g_free().

Definition at line 517 of file cr-fonts.c.

References _CRFontSize::absolute, ABSOLUTE_FONT_SIZE, cr_num_to_string(), INHERITED_FONT_SIZE, _CRFontSize::predefined, PREDEFINED_ABSOLUTE_FONT_SIZE, _CRFontSize::relative, RELATIVE_FONT_SIZE, _CRFontSize::type, and _CRFontSize::value.

Referenced by cr_style_to_string().

const gchar* cr_font_stretch_to_string ( enum CRFontStretch  a_code)
const gchar* cr_font_style_to_string ( enum CRFontStyle  a_code)

cr_font_style_to_string: : the current instance of CRFontStyle .

Returns the serialized CRFontStyle. The caller must free the returned string using g_free().

Definition at line 710 of file cr-fonts.c.

References FONT_STYLE_INHERIT, FONT_STYLE_ITALIC, FONT_STYLE_NORMAL, and FONT_STYLE_OBLIQUE.

Referenced by cr_style_to_string().

const gchar* cr_font_variant_to_string ( enum CRFontVariant  a_code)

cr_font_variant_to_string: : the current instance of CRFontVariant.

Returns the serialized form of CRFontVariant. The caller has to free the returned string using g_free().

Definition at line 742 of file cr-fonts.c.

References FONT_VARIANT_INHERIT, FONT_VARIANT_NORMAL, and FONT_VARIANT_SMALL_CAPS.

Referenced by cr_style_to_string().

cr_font_weight_get_bolder: : the CRFontWeight to consider.

Returns a font weight bolder than

Definition at line 767 of file cr-fonts.c.

References cr_utils_trace_info, FONT_WEIGHT_900, FONT_WEIGHT_BOLDER, FONT_WEIGHT_INHERIT, FONT_WEIGHT_LIGHTER, and FONT_WEIGHT_NORMAL.

const gchar* cr_font_weight_to_string ( enum CRFontWeight  a_code)

cr_font_weight_to_string: : the font weight to consider.

Returns the serialized form of CRFontWeight.

Definition at line 792 of file cr-fonts.c.

References 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_BOLD, FONT_WEIGHT_BOLDER, FONT_WEIGHT_INHERIT, FONT_WEIGHT_LIGHTER, and FONT_WEIGHT_NORMAL.

Referenced by cr_style_to_string().