Libcroco
Functions
cr-fonts.c File Reference
#include "cr-fonts.h"
#include <string.h>

Go to the source code of this file.

Functions

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

Function Documentation

◆ cr_font_family_append()

CRFontFamily* cr_font_family_append ( CRFontFamily a_this,
CRFontFamily a_family_to_append 
)

cr_font_family_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.

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

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

◆ cr_font_family_destroy()

enum CRStatus cr_font_family_destroy ( CRFontFamily a_this)

cr_font_family_destroy: @a_this: 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.

◆ cr_font_family_new()

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

cr_font_family_new: @a_type: the type of font family to create.

@a_name: 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.

◆ cr_font_family_prepend()

CRFontFamily* cr_font_family_prepend ( CRFontFamily a_this,
CRFontFamily a_family_to_prepend 
)

cr_font_family_prepend: @a_this: the current instance CRFontFamily.

@a_family_to_prepend: 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.

◆ cr_font_family_set_name()

enum CRStatus cr_font_family_set_name ( CRFontFamily a_this,
guchar *  a_name 
)

cr_font_family_set_name: @a_this: the current instance of CRFontFamily.

@a_name: 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().

◆ cr_font_family_to_string()

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

cr_font_family_to_string: @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().

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

References CR_OK.

◆ cr_font_size_adjust_destroy()

void cr_font_size_adjust_destroy ( CRFontSizeAdjust a_this)

cr_font_size_adjust_destroy: @a_this: 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()

CRFontSizeAdjust* cr_font_size_adjust_new ( void  )

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.

◆ cr_font_size_adjust_to_string()

gchar* cr_font_size_adjust_to_string ( CRFontSizeAdjust const *  a_this)

cr_font_size_adjust_to_string: @a_this: 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.

◆ cr_font_size_clear()

enum CRStatus cr_font_size_clear ( CRFontSize a_this)

cr_font_size_clear: @a_this: 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().

◆ cr_font_size_copy()

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

cr_font_size_copy: @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.

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().

◆ cr_font_size_destroy()

void cr_font_size_destroy ( CRFontSize a_font_size)

cr_font_size_destroy: @a_font_size: the font size to destroy

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

◆ 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 
)

cr_font_size_get_larger_predefined_font_size: @a_font_size: the font size to consider.

@a_larger_size: out parameter. the font size considered larger than @a_font_size.

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_font_size()

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: @a_font_size: the font size to consider.

@a_smaller_size: out parameter. The a smaller value than @a_font_size.

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()

gboolean cr_font_size_is_predefined_absolute_font_size ( enum CRPredefinedAbsoluteFontSize  a_font_size)

cr_font_size_is_predefined_absolute_font_size: @a_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.

◆ cr_font_size_is_set_to_inherit()

gboolean cr_font_size_is_set_to_inherit ( CRFontSize const *  a_this)

cr_font_size_is_set_to_inherit: @a_this: 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()

CRFontSize* cr_font_size_new ( void  )

cr_font_size_new:

Returns the newly created font size.

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

References cr_utils_trace_info.

◆ 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 
)

cr_font_size_set_absolute_font_size: @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.

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()

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: @a_this: the current instance of CRFontSize.

@a_predefined: 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()

enum CRStatus cr_font_size_set_relative_font_size ( CRFontSize a_this,
enum CRRelativeFontSize  a_relative 
)

cr_font_size_set_relative_font_size: @a_this: the current instance of CRFontSize @a_relative: 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()

enum CRStatus cr_font_size_set_to_inherit ( CRFontSize a_this)

cr_font_size_set_to_inherit: @a_this: 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().

◆ cr_font_size_to_string()

gchar* cr_font_size_to_string ( CRFontSize const *  a_this)

cr_font_size_to_string: @a_this: 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 PREDEFINED_ABSOLUTE_FONT_SIZE, and _CRFontSize::type.

◆ cr_font_stretch_to_string()

const gchar* cr_font_stretch_to_string ( enum CRFontStretch  a_code)

◆ cr_font_style_to_string()

const gchar* cr_font_style_to_string ( enum CRFontStyle  a_code)

cr_font_style_to_string: @a_code: 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.

◆ cr_font_variant_to_string()

const gchar* cr_font_variant_to_string ( enum CRFontVariant  a_code)

cr_font_variant_to_string: @a_code: 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.

◆ cr_font_weight_get_bolder()

enum CRFontWeight cr_font_weight_get_bolder ( enum CRFontWeight  a_weight)

cr_font_weight_get_bolder: @a_weight: the CRFontWeight to consider.

Returns a font weight bolder than @a_weight

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.

◆ cr_font_weight_to_string()

const gchar* cr_font_weight_to_string ( enum CRFontWeight  a_code)

cr_font_weight_to_string: @a_code: 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.