## cr-fonts

cr-fonts

## Synopsis

                        CRFontFamily;
                        CRFontSize;
                        CRFontSizeAdjust;
    CRFontFamily *      cr_font_family_new                  (enum CRFontFamilyType a_type,
                                                             guchar *a_name);
    CRFontFamily *      cr_font_family_append               (CRFontFamily *a_this,
                                                             CRFontFamily *a_family_to_append);
    guchar *            cr_font_family_to_string            (CRFontFamily const *a_this,
                                                             gboolean a_walk_font_family_list);
    CRFontFamily *      cr_font_family_prepend              (CRFontFamily *a_this,
                                                             CRFontFamily *a_family_to_prepend);
    enum CRStatus       cr_font_family_destroy              (CRFontFamily *a_this);
    enum CRStatus       cr_font_family_set_name             (CRFontFamily *a_this,
                                                             guchar *a_name);
    CRFontSize *        cr_font_size_new                    (void);
    enum CRStatus       cr_font_size_clear                  (CRFontSize *a_this);
    enum CRStatus       cr_font_size_copy                   (CRFontSize *a_dst,
                                                             CRFontSize const *a_src);
    enum CRStatus       cr_font_size_set_predefined_absolute_font_size
                                                            (CRFontSize *a_this,
                                                             enum CRPredefinedAbsoluteFontSize a_predefined);
    enum CRStatus       cr_font_size_set_relative_font_size (CRFontSize *a_this,
                                                             enum CRRelativeFontSize a_relative);
    enum CRStatus       cr_font_size_set_absolute_font_size (CRFontSize *a_this,
                                                             enum CRNumType a_num_type,
                                                             gdouble a_value);
    enum CRStatus       cr_font_size_set_to_inherit         (CRFontSize *a_this);
    gboolean            cr_font_size_is_set_to_inherit      (CRFontSize const *a_this);
    gchar *             cr_font_size_to_string              (CRFontSize const *a_this);
    void                cr_font_size_destroy                (CRFontSize *a_font_size);
    CRFontSizeAdjust *  cr_font_size_adjust_new             (void);
    gchar *             cr_font_size_adjust_to_string       (CRFontSizeAdjust const *a_this);
    void                cr_font_size_adjust_destroy         (CRFontSizeAdjust *a_this);
    void                cr_font_size_get_smaller_predefined_font_size
                                                            (enum CRPredefinedAbsoluteFontSize a_font_size,
                                                             enum CRPredefinedAbsoluteFontSize *a_smaller_size);
    void                cr_font_size_get_larger_predefined_font_size
                                                            (enum CRPredefinedAbsoluteFontSize a_font_size,
                                                             enum CRPredefinedAbsoluteFontSize *a_larger_size);
    gboolean            cr_font_size_is_predefined_absolute_font_size
                                                            (enum CRPredefinedAbsoluteFontSize a_font_size);
    const gchar *       cr_font_style_to_string             (enum CRFontStyle a_code);
    const gchar *       cr_font_weight_to_string            (enum CRFontWeight a_code);
    enum CRFontWeight   cr_font_weight_get_bolder           (enum CRFontWeight a_weight);
    const gchar *       cr_font_variant_to_string           (enum CRFontVariant a_code);
    const gchar *       cr_font_stretch_to_string           (enum CRFontStretch a_code);

## Description

## Details

### CRFontFamily

    typedef struct {
    	enum CRFontFamilyType type ;

    	/*
    	 *The name of the font family, in case
    	 *it is non generic.
    	 *Is set only if the type is FONT_FAMILY_NON_GENERIC.
    	 */
    	guchar *name ;

    	CRFontFamily *next ;
    	CRFontFamily *prev ;
    } CRFontFamily;

### CRFontSize

    typedef struct {
            enum CRFontSizeType type ;
            union  {
                    enum CRPredefinedAbsoluteFontSize predefined ;
                    enum CRRelativeFontSize relative ;
                    CRNum absolute ;
            } value;
    } CRFontSize;

### CRFontSizeAdjust

    typedef struct {
            enum CRFontSizeAdjustType type ;
            CRNum *num ;
    } CRFontSizeAdjust;

### cr_font_family_new ()

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

create a font family.

`a_type` : | the type of font family to create.
`a_name` : | the name of the font family.
Returns : | the newly built font family.

### cr_font_family_append ()

    CRFontFamily *      cr_font_family_append               (CRFontFamily *a_this,
                                                             CRFontFamily *a_family_to_append);

`a_this` : | the current instance of CRFontFamily.
`a_family_to_append` : | the font family to append to the list
Returns : | the new font family list.

### cr_font_family_to_string ()

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

`a_this` : | the current instance of CRFontFamily.
`a_walk_font_family_list` : | wether the serialize the entire list.
Returns : | the seriliazed font family. The caller has to free it using `g_free()`.

### cr_font_family_prepend ()

    CRFontFamily *      cr_font_family_prepend              (CRFontFamily *a_this,
                                                             CRFontFamily *a_family_to_prepend);

`a_this` : | the current instance CRFontFamily.
`a_family_to_prepend` : | the font family to prepend to the list.
Returns : | the font family list.

### cr_font_family_destroy ()

    enum CRStatus       cr_font_family_destroy              (CRFontFamily *a_this);

`a_this` : | the current instance of CRFontFamily.
Returns : | CR_OK upon sucessful completion, an error code otherwise.

### cr_font_family_set_name ()

    enum CRStatus       cr_font_family_set_name             (CRFontFamily *a_this,
                                                             guchar *a_name);

`a_this` : | the current instance of CRFontFamily.
`a_name` : | the new name
Returns : | CR_OK upon sucessful completion, an error code otherwise.

### cr_font_size_new ()

    CRFontSize *        cr_font_size_new                    (void);

Returns : | the newly created font size.

### cr_font_size_clear ()

    enum CRStatus       cr_font_size_clear                  (CRFontSize *a_this);

`a_this` : | the current instance of CRFontSize
Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_font_size_copy ()

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

`a_dst` : | the destination CRFontSize (where to copy to).
`a_src` : | the source CRFontSize (where to copy from).
Returns : | CR_OK upon successful completion, an error code otherwise.

### 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);

`a_this` : | the current instance of CRFontSize.
`a_predefined` : | what to set.
Returns : | CR_OK upon sucessful completion, an error code otherwise.

### cr_font_size_set_relative_font_size ()

    enum CRStatus       cr_font_size_set_relative_font_size (CRFontSize *a_this,
                                                             enum CRRelativeFontSize a_relative);

`a_this` : | the current instance of CRFontSize
`a_relative` : | the new relative font size
Returns : | CR_OK upon successful completion, an error code otherwise.

### 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);

`a_this` : | the current instance of CRFontSize
`a_num_type` : | the type of number to set.
`a_value` : | the actual value to set.
Returns : | CR_OK upon succesful completion, an error code otherwise.

### cr_font_size_set_to_inherit ()

    enum CRStatus       cr_font_size_set_to_inherit         (CRFontSize *a_this);

`a_this` : | the current instance of CRFontSize
Returns : | CR_OK upon succesful completion, an error code otherwise.

### cr_font_size_is_set_to_inherit ()

    gboolean            cr_font_size_is_set_to_inherit      (CRFontSize const *a_this);

`a_this` : | the current instance of CRFontSize.
Returns : | TRUE if the current instance is set to 'inherit'.

### cr_font_size_to_string ()

    gchar *             cr_font_size_to_string              (CRFontSize const *a_this);

`a_this` : | the current instance of CRFontSize
Returns : | the serialized form of CRFontSize. The returned string has to bee freed using `g_free()`.

### cr_font_size_destroy ()

    void                cr_font_size_destroy                (CRFontSize *a_font_size);

`a_font_size` : | the font size to destroy

### cr_font_size_adjust_new ()

    CRFontSizeAdjust *  cr_font_size_adjust_new             (void);

Returns : | a newly built instance of CRFontSizeAdjust

### cr_font_size_adjust_to_string ()

    gchar *             cr_font_size_adjust_to_string       (CRFontSizeAdjust const *a_this);

`a_this` : | the instance of CRFontSizeAdjust.
Returns : | the serialized form of CRFontSizeAdjust

### cr_font_size_adjust_destroy ()

    void                cr_font_size_adjust_destroy         (CRFontSizeAdjust *a_this);

`a_this` : | the current instance of CRFontSizeAdjust.

### 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);

`a_font_size` : |
`a_smaller_size` : |

### 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);

`a_font_size` : | the font size to consider.
`a_larger_size` : | out parameter. the font size considered larger than `a_font_size`.

### cr_font_size_is_predefined_absolute_font_size ()

    gboolean            cr_font_size_is_predefined_absolute_font_size
                                                            (enum CRPredefinedAbsoluteFontSize a_font_size);

`a_font_size` : | the font size to consider.
Returns : | TRUE if the instance is an predefined absolute font size, FALSE otherwise.

### cr_font_style_to_string ()

    const gchar *       cr_font_style_to_string             (enum CRFontStyle a_code);

`a_code` : | the current instance of CRFontStyle .
Returns : | the serialized CRFontStyle. The caller must free the returned string using `g_free()`.

### cr_font_weight_to_string ()

    const gchar *       cr_font_weight_to_string            (enum CRFontWeight a_code);

`a_code` : | the font weight to consider.
Returns : | the serialized form of CRFontWeight.

### cr_font_weight_get_bolder ()

    enum CRFontWeight   cr_font_weight_get_bolder           (enum CRFontWeight a_weight);

`a_weight` : | the CRFontWeight to consider.
Returns : | a font weight bolder than `a_weight`

### cr_font_variant_to_string ()

    const gchar *       cr_font_variant_to_string           (enum CRFontVariant a_code);

`a_code` : | the current instance of CRFontVariant.
Returns : | the serialized form of CRFontVariant. The caller has to free the returned string using `g_free()`.

### cr_font_stretch_to_string ()

    const gchar *       cr_font_stretch_to_string           (enum CRFontStretch a_code);

`a_code` : | the instance of CRFontStretch to consider.
Returns : | the serialized form of CRFontStretch.