[lasem/mml-attrs] [Mathml] Migration to lsm_attribute_manager WIP.



commit 0809617a739e542e650ab1864ce2668349403d21
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon Dec 28 21:45:42 2009 +0100

    [Mathml] Migration to lsm_attribute_manager WIP.
    
    lsm_mathml_color_attribute

 src/lsmmathmlattributes.c        |  155 +++-----------------------------------
 src/lsmmathmlattributes.h        |   48 ++----------
 src/lsmmathmlpresentationtoken.c |   36 ++++++----
 src/lsmmathmlstyleelement.c      |   39 ++++++----
 src/lsmmathmltraits.c            |  155 ++++++++++++++++++++++++++++++++++++++
 src/lsmmathmltraits.h            |   56 +++++++++++---
 6 files changed, 263 insertions(+), 226 deletions(-)
---
diff --git a/src/lsmmathmlattributes.c b/src/lsmmathmlattributes.c
index db1b25f..f72c70b 100644
--- a/src/lsmmathmlattributes.c
+++ b/src/lsmmathmlattributes.c
@@ -48,6 +48,15 @@ lsm_mathml_double_attribute_inherit (LsmMathmlDoubleAttribute *attribute, double
 	return attribute->value;
 }
 
+LsmMathmlColor
+lsm_mathml_color_attribute_inherit (LsmMathmlColorAttribute *attribute, LsmMathmlColor value)
+{
+	if (attribute->base.value == NULL)
+		attribute->color = value;
+
+	return attribute->color;
+}
+
 const char *
 lsm_mathml_string_attribute_inherit (LsmMathmlStringAttribute *attribute, const char *string)
 {
@@ -483,66 +492,6 @@ lsm_mathml_attribute_map_add_enum_list (LsmMathmlAttributeMap *map,
 	lsm_mathml_attribute_map_add_attribute_full (map, name, offset, &enum_list_attribute_class);
 }
 
-static LsmMathmlColor *
-lsm_mathml_color_copy (LsmMathmlColor *color)
-{
-	LsmMathmlColor *copy;
-
-	copy = g_new (LsmMathmlColor, 1);
-	memcpy (copy, color, sizeof (LsmMathmlColor));
-
-	return copy;
-}
-
-GType
-lsm_mathml_color_get_type (void)
-{
-	static GType our_type = 0;
-	if (our_type == 0)
-		our_type = g_boxed_type_register_static
-			("LsmMathmlColor",
-			 (GBoxedCopyFunc) lsm_mathml_color_copy,
-			 (GBoxedFreeFunc) g_free);
-	return our_type;
-}
-
-static LsmMathmlSpace *
-lsm_mathml_space_copy (LsmMathmlSpace *space)
-{
-	LsmMathmlSpace *copy;
-
-	copy = g_new (LsmMathmlSpace, 1);
-	memcpy (copy, space, sizeof (LsmMathmlSpace));
-
-	return copy;
-}
-
-GType
-lsm_mathml_space_get_type (void)
-{
-	static GType our_type = 0;
-
-	if (our_type == 0)
-		our_type = g_boxed_type_register_static
-			("LsmMathmlSpace",
-			 (GBoxedCopyFunc) lsm_mathml_space_copy,
-			 (GBoxedFreeFunc) g_free);
-	return our_type;
-}
-
-GType
-lsm_mathml_space_list_get_type (void)
-{
-	static GType our_type = 0;
-
-	if (our_type == 0)
-		our_type = g_boxed_type_register_static
-			("LsmMathmlSpaceList",
-			 (GBoxedCopyFunc) lsm_mathml_space_list_duplicate,
-			 (GBoxedFreeFunc) lsm_mathml_space_list_free);
-	return our_type;
-}
-
 void
 lsm_mathml_script_level_attribute_parse (LsmMathmlScriptLevelAttribute *attribute,
 					 int *style_value)
@@ -570,41 +519,6 @@ lsm_mathml_script_level_attribute_parse (LsmMathmlScriptLevelAttribute *attribut
 }
 
 void
-lsm_mathml_color_attribute_parse (LsmMathmlColorAttribute *attribute,
-				  LsmMathmlColor *style_color)
-{
-	const char *string;
-
-	g_return_if_fail (attribute != NULL);
-	g_return_if_fail (style_color != NULL);
-
-	string = lsm_mathml_attribute_get_value ((LsmMathmlAttribute *) attribute);
-	if (string == NULL) {
-		attribute->color.red = style_color->red;
-		attribute->color.green = style_color->green;
-		attribute->color.blue = style_color->blue;
-		attribute->color.alpha = style_color->alpha;
-		return;
-	}
-
-	if (strcmp (string, "transparent") == 0) {
-		attribute->color.red = 0.0;
-		attribute->color.green = 0.0;
-		attribute->color.blue = 0.0;
-		attribute->color.alpha = 0.0;
-	} else {
-		PangoColor color;
-
-		pango_color_parse (&color, string);
-		attribute->color.alpha = 1.0;
-		attribute->color.red = color.red / 65535.0;
-		attribute->color.green = color.green / 65535.0;
-		attribute->color.blue = color.blue / 65535.0;
-	}
-	*style_color = attribute->color;
-}
-
-void
 lsm_mathml_space_attribute_parse (LsmMathmlSpaceAttribute *attribute,
 				  LsmMathmlSpace *style_value,
 				  LsmMathmlStyle *style)
@@ -678,56 +592,6 @@ lsm_mathml_space_attribute_parse (LsmMathmlSpaceAttribute *attribute,
 	}
 }
 
-LsmMathmlSpaceList *
-lsm_mathml_space_list_new (unsigned int n_spaces)
-{
-	LsmMathmlSpaceList *space_list;
-
-	space_list = g_new (LsmMathmlSpaceList, 1);
-	if (space_list == NULL)
-		return NULL;
-
-	space_list->n_spaces = n_spaces;
-
-	if (n_spaces > 0) {
-		space_list->spaces = g_new (LsmMathmlSpace, n_spaces);
-
-		if (space_list->spaces == NULL) {
-			g_free (space_list);
-			return NULL;
-		}
-	} else
-		space_list->spaces = NULL;
-
-	return space_list;
-}
-
-void
-lsm_mathml_space_list_free (LsmMathmlSpaceList *space_list)
-{
-	if (space_list == NULL)
-		return;
-
-	space_list->n_spaces = 0;
-
-	g_free (space_list->spaces);
-	g_free (space_list);
-}
-
-LsmMathmlSpaceList *
-lsm_mathml_space_list_duplicate (const LsmMathmlSpaceList *space_list)
-{
-	LsmMathmlSpaceList *new_space_list;
-
-	g_return_val_if_fail (space_list != NULL, NULL);
-
-	new_space_list = lsm_mathml_space_list_new (space_list->n_spaces);
-	memcpy (new_space_list->spaces, space_list->spaces,
-		sizeof (LsmMathmlSpace) * space_list->n_spaces);
-
-	return new_space_list;
-}
-
 static void
 lsm_mathml_space_list_attribute_finalize (void *abstract)
 {
@@ -887,3 +751,4 @@ lsm_mathml_attribute_map_add_space_list (LsmMathmlAttributeMap *map,
 {
 	lsm_mathml_attribute_map_add_attribute_full (map, name, offset, &space_list_attribute_class);
 }
+
diff --git a/src/lsmmathmlattributes.h b/src/lsmmathmlattributes.h
index 1b96aa4..d6aa93c 100644
--- a/src/lsmmathmlattributes.h
+++ b/src/lsmmathmlattributes.h
@@ -27,7 +27,6 @@
 #include <lsmmathml.h>
 #include <lsmmathmlenums.h>
 #include <lsmmathmltraits.h>
-#include <pango/pango-attributes.h>
 
 G_BEGIN_DECLS
 
@@ -53,6 +52,11 @@ typedef struct {
 
 typedef struct {
 	LsmAttribute base;
+	LsmMathmlColor color;
+} LsmMathmlColorAttribute;
+
+typedef struct {
+	LsmAttribute base;
 	char *value;
 } LsmMathmlStringAttribute;
 
@@ -62,6 +66,8 @@ unsigned int		lsm_mathml_enum_attribute_inherit	(LsmMathmlEnumAttribute *attribu
 								 unsigned int value);
 double 			lsm_mathml_double_attribute_inherit 	(LsmMathmlDoubleAttribute *attribute,
 								 double value);
+LsmMathmlColor		lsm_mathml_color_attribute_inherit 	(LsmMathmlColorAttribute *attribute,
+								 LsmMathmlColor value);
 const char *		lsm_mathml_string_attribute_inherit	(LsmMathmlStringAttribute *attribute,
 								 const char *string);
 
@@ -162,35 +168,6 @@ typedef struct {
 	unsigned int *values;
 } LsmMathmlEnumListAttribute;
 
-GType lsm_mathml_color_get_type (void);
-
-#define LSM_TYPE_MATHML_COLOR (lsm_mathml_color_get_type())
-
-typedef struct {
-	double red;
-	double green;
-	double blue;
-	double alpha;
-} LsmMathmlColor;
-
-GType lsm_mathml_length_get_type (void);
-
-#define LSM_TYPE_MATHML_LENGTH (lsm_mathml_length_get_type())
-
-typedef struct {
-	LsmMathmlSpaceName name;
-	LsmMathmlLength length;
-} LsmMathmlSpace;
-
-GType lsm_mathml_space_list_get_type (void);
-
-#define LSM_TYPE_MATHML_SPACE_LIST (lsm_mathml_space_list_get_type())
-
-typedef struct {
-	unsigned int n_spaces;
-	LsmMathmlSpace *spaces;
-} LsmMathmlSpaceList;
-
 typedef struct {
 	LsmMathmlAttribute attr;
 	int value;
@@ -198,11 +175,6 @@ typedef struct {
 
 typedef struct {
 	LsmMathmlAttribute attr;
-	LsmMathmlColor color;
-} LsmMathmlColorAttribute;
-
-typedef struct {
-	LsmMathmlAttribute attr;
 	LsmMathmlSpace space;
 	double value;
 } LsmMathmlSpaceAttribute;
@@ -227,16 +199,10 @@ void 		lsm_mathml_attribute_map_add_enum_list 	(LsmMathmlAttributeMap *map,
 
 void 		lsm_mathml_script_level_attribute_parse	(LsmMathmlScriptLevelAttribute *attribute,
 							 int *default_value);
-void		lsm_mathml_color_attribute_parse	(LsmMathmlColorAttribute *attribute,
-							 LsmMathmlColor *default_color);
 void 		lsm_mathml_space_attribute_parse 	(LsmMathmlSpaceAttribute *attribute,
 							 LsmMathmlSpace *style_value,
 							 LsmMathmlStyle *style);
 
-LsmMathmlSpaceList *	lsm_mathml_space_list_new  	(unsigned int n_spaces);
-void 			lsm_mathml_space_list_free 	(LsmMathmlSpaceList *space_list);
-LsmMathmlSpaceList *	lsm_mathml_space_list_duplicate	(const LsmMathmlSpaceList *space_list);
-
 void 		lsm_mathml_space_list_attribute_parse 	(LsmMathmlSpaceListAttribute *attribute,
 							 LsmMathmlSpaceList *style_value,
 							 const LsmMathmlStyle *style);
diff --git a/src/lsmmathmlpresentationtoken.c b/src/lsmmathmlpresentationtoken.c
index 2e8be4a..97727a7 100644
--- a/src/lsmmathmlpresentationtoken.c
+++ b/src/lsmmathmlpresentationtoken.c
@@ -108,8 +108,8 @@ lsm_mathml_presentation_token_update (LsmMathmlElement *self, LsmMathmlStyle *st
 					  lsm_mathml_string_attribute_inherit (&token->math_family,
 									       style->math_family));
 	style->math_variant = lsm_mathml_enum_attribute_inherit (&token->math_variant, style->math_variant);
-	lsm_mathml_color_attribute_parse (&token->math_color, &style->math_color);
-	lsm_mathml_color_attribute_parse (&token->math_background, &style->math_background);
+	style->math_color = lsm_mathml_color_attribute_inherit (&token->math_color, style->math_color);
+	style->math_background = lsm_mathml_color_attribute_inherit (&token->math_background, style->math_background);
 	style->math_size = lsm_mathml_length_attribute_normalize (&token->math_size, style->math_size,
 								  style->math_size);
 }
@@ -221,6 +221,16 @@ static const LsmAttributeInfos _attribute_infos[] = {
 		.attribute_offset = offsetof (LsmMathmlPresentationToken, math_variant),
 		.trait_class = &lsm_mathml_variant_trait_class,
 	},
+	{
+		.name = "mathcolor",
+		.attribute_offset = offsetof (LsmMathmlPresentationToken, math_color),
+		.trait_class = &lsm_mathml_color_trait_class,
+	},
+	{
+		.name = "mathbackground",
+		.attribute_offset = offsetof (LsmMathmlPresentationToken, math_background),
+		.trait_class = &lsm_mathml_color_trait_class,
+	},
 	/* Deprecated attributes */
 	{
 		.name = "fontfamily",
@@ -244,6 +254,16 @@ static const LsmAttributeInfos _attribute_infos[] = {
 		.attribute_offset = offsetof (LsmMathmlPresentationToken, font_weight),
 		.trait_class = &lsm_mathml_font_weight_trait_class,
 		.trait_default = &font_weight_default
+	},
+	{
+		.name = "color",
+		.attribute_offset = offsetof (LsmMathmlPresentationToken, math_color),
+		.trait_class = &lsm_mathml_color_trait_class,
+	},
+	{
+		.name = "background",
+		.attribute_offset = offsetof (LsmMathmlPresentationToken, math_background),
+		.trait_class = &lsm_mathml_color_trait_class,
 	}
 };
 
@@ -271,18 +291,6 @@ lsm_mathml_presentation_token_class_init (LsmMathmlPresentationTokenClass *m_tok
 	m_element_class->update = lsm_mathml_presentation_token_update;
 
 	m_token_class->get_text = _get_text;
-
-	m_element_class->attributes = lsm_mathml_attribute_map_duplicate (m_element_class->attributes);
-
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "mathcolor",
-					     offsetof (LsmMathmlPresentationToken, math_color));
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "mathbackground",
-					     offsetof (LsmMathmlPresentationToken, math_background));
-
-	/* Deprecated attributes */
-
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "color",
-					     offsetof (LsmMathmlPresentationToken, math_color));
 }
 
 G_DEFINE_TYPE (LsmMathmlPresentationToken, lsm_mathml_presentation_token, LSM_TYPE_MATHML_ELEMENT)
diff --git a/src/lsmmathmlstyleelement.c b/src/lsmmathmlstyleelement.c
index d17bf73..db1a2c2 100644
--- a/src/lsmmathmlstyleelement.c
+++ b/src/lsmmathmlstyleelement.c
@@ -49,7 +49,6 @@ lsm_mathml_style_element_update (LsmMathmlElement *self, LsmMathmlStyle *style)
 
 	style->script_size_multiplier = lsm_mathml_double_attribute_inherit (&style_element->script_size_multiplier,
 									     style->script_size_multiplier);
-	lsm_mathml_color_attribute_parse (&style_element->math_background, &style->math_background);
 	style->script_min_size = lsm_mathml_length_attribute_normalize (&style_element->script_min_size,
 								       style->script_min_size,
 								       style->math_size);
@@ -65,8 +64,10 @@ lsm_mathml_style_element_update (LsmMathmlElement *self, LsmMathmlStyle *style)
 	lsm_mathml_style_set_math_family (style,
 					  lsm_mathml_string_attribute_inherit (&style_element->math_family,
 									       style->math_family));
-	lsm_mathml_color_attribute_parse (&style_element->math_color, &style->math_color);
-	lsm_mathml_color_attribute_parse (&style_element->math_background, &style->math_background);
+	style->math_color = lsm_mathml_color_attribute_inherit (&style_element->math_color,
+								style->math_color);
+	style->math_background = lsm_mathml_color_attribute_inherit (&style_element->math_background,
+								     style->math_background);
 	style->math_variant = lsm_mathml_enum_attribute_inherit (&style_element->math_variant, style->math_variant);
 	style->math_size = lsm_mathml_length_attribute_normalize (&style_element->math_size,
 								  style->math_size,
@@ -211,6 +212,16 @@ static const LsmAttributeInfos _attribute_infos[] = {
 		.trait_class = &lsm_mathml_variant_trait_class,
 	},
 	{
+		.name = "mathcolor",
+		.attribute_offset = offsetof (LsmMathmlStyleElement, math_color),
+		.trait_class = &lsm_mathml_color_trait_class,
+	},
+	{
+		.name = "mathbackground",
+		.attribute_offset = offsetof (LsmMathmlStyleElement, math_background),
+		.trait_class = &lsm_mathml_color_trait_class,
+	},
+	{
 		.name = "linethickness",
 		.attribute_offset = offsetof (LsmMathmlStyleElement, line_thickness),
 		.trait_class = &lsm_mathml_length_trait_class,
@@ -233,6 +244,16 @@ static const LsmAttributeInfos _attribute_infos[] = {
 		.attribute_offset = offsetof (LsmMathmlStyleElement, font_weight),
 		.trait_class = &lsm_mathml_font_weight_trait_class,
 		.trait_default = &font_weight_default
+	},
+	{
+		.name = "color",
+		.attribute_offset = offsetof (LsmMathmlStyleElement, math_color),
+		.trait_class = &lsm_mathml_color_trait_class,
+	},
+	{
+		.name = "background",
+		.attribute_offset = offsetof (LsmMathmlStyleElement, math_background),
+		.trait_class = &lsm_mathml_color_trait_class,
 	}
 };
 
@@ -257,18 +278,6 @@ lsm_mathml_style_element_class_init (LsmMathmlStyleElementClass *style_class)
 
 	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "scriptlevel",
 					  offsetof (LsmMathmlStyleElement, script_level));
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "background",
-					  offsetof (LsmMathmlStyleElement, math_background));
-
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "mathcolor",
-					  offsetof (LsmMathmlStyleElement, math_color));
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "mathbackground",
-					  offsetof (LsmMathmlStyleElement, math_background));
-
-	/* Deprecated attributes */
-
-	lsm_mathml_attribute_map_add_attribute (m_element_class->attributes, "color",
-					  offsetof (LsmMathmlStyleElement, math_color));
 }
 
 G_DEFINE_TYPE (LsmMathmlStyleElement, lsm_mathml_style_element, LSM_TYPE_MATHML_PRESENTATION_CONTAINER)
diff --git a/src/lsmmathmltraits.c b/src/lsmmathmltraits.c
index df15fc0..4492020 100644
--- a/src/lsmmathmltraits.c
+++ b/src/lsmmathmltraits.c
@@ -19,6 +19,7 @@
  * 	Emmanuel Pacaud <emmanuel gnome org>
  */
 
+#include <pango/pango-attributes.h>
 #include <lsmmathmltraits.h>
 #include <math.h>
 #include <string.h>
@@ -244,6 +245,72 @@ const LsmTraitClass lsm_mathml_double_trait_class = {
 	.to_string = lsm_mathml_double_trait_to_string
 };
 
+static LsmMathmlColor *
+lsm_mathml_color_copy (LsmMathmlColor *color)
+{
+	LsmMathmlColor *copy;
+
+	copy = g_new (LsmMathmlColor, 1);
+	memcpy (copy, color, sizeof (LsmMathmlColor));
+
+	return copy;
+}
+
+GType
+lsm_mathml_color_get_type (void)
+{
+	static GType our_type = 0;
+	if (our_type == 0)
+		our_type = g_boxed_type_register_static
+			("LsmMathmlColor",
+			 (GBoxedCopyFunc) lsm_mathml_color_copy,
+			 (GBoxedFreeFunc) g_free);
+	return our_type;
+}
+
+static void
+lsm_mathml_color_trait_from_string (LsmTrait *abstract_trait, char *string)
+{
+	LsmMathmlColor *color = (LsmMathmlColor *) abstract_trait;
+
+	if (strcmp (string, "transparent") == 0) {
+		color->red = 0.0;
+		color->green = 0.0;
+		color->blue = 0.0;
+		color->alpha = 0.0;
+	} else {
+		PangoColor pango_color;
+
+		pango_color_parse (&pango_color, string);
+		color->alpha = 1.0;
+		color->red = pango_color.red / 65535.0;
+		color->green = pango_color.green / 65535.0;
+		color->blue = pango_color.blue / 65535.0;
+	}
+}
+
+static char *
+lsm_mathml_color_trait_to_string (LsmTrait *abstract_trait)
+{
+	LsmMathmlColor *color = (LsmMathmlColor *) abstract_trait;
+	PangoColor pango_color;
+
+	if (color->alpha <= 0.0)
+		return g_strdup ("transparent");
+
+	pango_color.red = ((int) ((double) 0.5 + 65535.0 * color->red));
+	pango_color.blue = ((int) ((double) 0.5 + 65535.0 * color->blue));
+	pango_color.green = ((int) ((double) 0.5 + 65535.0 * color->green));
+
+	return pango_color_to_string (&pango_color);
+}
+
+const LsmTraitClass lsm_mathml_color_trait_class = {
+	.size = sizeof (LsmMathmlColor),
+	.from_string = lsm_mathml_color_trait_from_string,
+	.to_string = lsm_mathml_color_trait_to_string
+};
+
 static void
 lsm_mathml_string_trait_from_string (LsmTrait *abstract_trait, char *string)
 {
@@ -370,3 +437,91 @@ lsm_mathml_length_normalize (const LsmMathmlLength *length, double default_value
 
 	return value;
 }
+
+static LsmMathmlSpace *
+lsm_mathml_space_copy (LsmMathmlSpace *space)
+{
+	LsmMathmlSpace *copy;
+
+	copy = g_new (LsmMathmlSpace, 1);
+	memcpy (copy, space, sizeof (LsmMathmlSpace));
+
+	return copy;
+}
+
+GType
+lsm_mathml_space_get_type (void)
+{
+	static GType our_type = 0;
+
+	if (our_type == 0)
+		our_type = g_boxed_type_register_static
+			("LsmMathmlSpace",
+			 (GBoxedCopyFunc) lsm_mathml_space_copy,
+			 (GBoxedFreeFunc) g_free);
+	return our_type;
+}
+
+GType
+lsm_mathml_space_list_get_type (void)
+{
+	static GType our_type = 0;
+
+	if (our_type == 0)
+		our_type = g_boxed_type_register_static
+			("LsmMathmlSpaceList",
+			 (GBoxedCopyFunc) lsm_mathml_space_list_duplicate,
+			 (GBoxedFreeFunc) lsm_mathml_space_list_free);
+	return our_type;
+}
+
+LsmMathmlSpaceList *
+lsm_mathml_space_list_new (unsigned int n_spaces)
+{
+	LsmMathmlSpaceList *space_list;
+
+	space_list = g_new (LsmMathmlSpaceList, 1);
+	if (space_list == NULL)
+		return NULL;
+
+	space_list->n_spaces = n_spaces;
+
+	if (n_spaces > 0) {
+		space_list->spaces = g_new (LsmMathmlSpace, n_spaces);
+
+		if (space_list->spaces == NULL) {
+			g_free (space_list);
+			return NULL;
+		}
+	} else
+		space_list->spaces = NULL;
+
+	return space_list;
+}
+
+void
+lsm_mathml_space_list_free (LsmMathmlSpaceList *space_list)
+{
+	if (space_list == NULL)
+		return;
+
+	space_list->n_spaces = 0;
+
+	g_free (space_list->spaces);
+	g_free (space_list);
+}
+
+LsmMathmlSpaceList *
+lsm_mathml_space_list_duplicate (const LsmMathmlSpaceList *space_list)
+{
+	LsmMathmlSpaceList *new_space_list;
+
+	g_return_val_if_fail (space_list != NULL, NULL);
+
+	new_space_list = lsm_mathml_space_list_new (space_list->n_spaces);
+	memcpy (new_space_list->spaces, space_list->spaces,
+		sizeof (LsmMathmlSpace) * space_list->n_spaces);
+
+	return new_space_list;
+}
+
diff --git a/src/lsmmathmltraits.h b/src/lsmmathmltraits.h
index 52fda1b..4583a8e 100644
--- a/src/lsmmathmltraits.h
+++ b/src/lsmmathmltraits.h
@@ -27,7 +27,50 @@
 
 G_BEGIN_DECLS
 
+#define LSM_TYPE_MATHML_COLOR (lsm_mathml_color_get_type())
+
+typedef struct {
+	double red;
+	double green;
+	double blue;
+	double alpha;
+} LsmMathmlColor;
+
+GType lsm_mathml_color_get_type (void);
+
+#define LSM_TYPE_MATHML_LENGTH (lsm_mathml_length_get_type())
+
+typedef struct {
+	double value;
+	LsmMathmlUnit unit;
+} LsmMathmlLength;
+
+GType lsm_mathml_length_get_type (void);
+double 	lsm_mathml_length_normalize 	(const LsmMathmlLength *length, double default_value, double font_size);
+
+#define LSM_TYPE_MATHML_SPACE (lsm_mathml_space_get_type())
+
+typedef struct {
+	LsmMathmlSpaceName name;
+	LsmMathmlLength length;
+} LsmMathmlSpace;
+
+GType 	lsm_mathml_space_get_type 	(void);
+
+#define LSM_TYPE_MATHML_SPACE_LIST (lsm_mathml_space_list_get_type())
+
+typedef struct {
+	unsigned int n_spaces;
+	LsmMathmlSpace *spaces;
+} LsmMathmlSpaceList;
+
+GType 			lsm_mathml_space_list_get_type 	(void);
+LsmMathmlSpaceList *	lsm_mathml_space_list_new  	(unsigned int n_spaces);
+void 			lsm_mathml_space_list_free 	(LsmMathmlSpaceList *space_list);
+LsmMathmlSpaceList *	lsm_mathml_space_list_duplicate	(const LsmMathmlSpaceList *space_list);
+
 extern const LsmTraitClass lsm_mathml_boolean_trait_class;
+
 extern const LsmTraitClass lsm_mathml_unsigned_trait_class;
 extern const LsmTraitClass lsm_mathml_display_trait_class;
 extern const LsmTraitClass lsm_mathml_mode_trait_class;
@@ -36,21 +79,12 @@ extern const LsmTraitClass lsm_mathml_font_style_trait_class;
 extern const LsmTraitClass lsm_mathml_font_weight_trait_class;
 extern const LsmTraitClass lsm_mathml_variant_trait_class;
 extern const LsmTraitClass lsm_mathml_form_trait_class;
+
 extern const LsmTraitClass lsm_mathml_double_trait_class;
 extern const LsmTraitClass lsm_mathml_string_trait_class;
-
-typedef struct {
-	double value;
-	LsmMathmlUnit unit;
-} LsmMathmlLength;
-
-GType lsm_mathml_space_get_type (void);
-
-#define LSM_TYPE_MATHML_SPACE (lsm_mathml_space_get_type())
-
 extern const LsmTraitClass lsm_mathml_length_trait_class;
 
-double 	lsm_mathml_length_normalize 	(const LsmMathmlLength *length, double default_value, double font_size);
+extern const LsmTraitClass lsm_mathml_color_trait_class;
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]