[gnumeric] ODF: font-size in chart labels



commit 6e75721fc403d80e8e8a6d30751b904bebe9ca47
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Aug 20 15:28:22 2010 -0600

    ODF: font-size in chart labels
    
    2010-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_apply_style_props): handle font-size
    	(oo_parse_distance): change argument to gnm_float and change all callers
    	(od_style_prop_chart): handle font-size
    	* openoffice-write.c (odf_write_gog_style_text): write font-size
    
    2010-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* samples/chart-tests.gnumeric: update tab colours

 ChangeLog                             |    4 ++++
 plugins/openoffice/ChangeLog          |    7 +++++++
 plugins/openoffice/openoffice-read.c  |   16 +++++++++++++---
 plugins/openoffice/openoffice-write.c |    7 ++++++-
 samples/chart-tests.gnumeric          |  Bin 807386 -> 807387 bytes
 5 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ded9076..d56bfde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* samples/chart-tests.gnumeric: update tab colours
+
 2010-08-18  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* samples/chart-tests.gnumeric: add tab colours to indicate ODF support
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 9038e6c..6592aef 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,12 @@
 2010-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (odf_apply_style_props): handle font-size
+	(oo_parse_distance): change argument to gnm_float and change all callers
+	(od_style_prop_chart): handle font-size
+	* openoffice-write.c (odf_write_gog_style_text): write font-size
+
+2010-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (oo_date_text_end_append): new
 	(oo_date_text_end): take care of %-signs if we are in a percentage style
 	(odf_number_percentage_style): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index bb5ca66..2de8b2e 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -521,6 +521,12 @@ odf_apply_style_props (GSList *props, GOStyle *style)
 		} else if (0 == strcmp (prop->name, "text-rotation-angle")) {
 			int angle = g_value_get_int (&prop->value);
 			go_style_set_text_angle (style, angle);
+		} else if (0 == strcmp (prop->name, "font-size")) {
+			PangoFontDescription *desc;
+			
+			desc = pango_font_description_copy (style->font.font->desc);
+			pango_font_description_set_size (desc, PANGO_SCALE * g_value_get_double (&prop->value));
+			go_style_set_font_desc	(style, desc);
 		}
 	}
 }
@@ -532,7 +538,7 @@ odf_apply_style_props (GSList *props, GOStyle *style)
 /* returns pts */
 static char const *
 oo_parse_distance (GsfXMLIn *xin, xmlChar const *str,
-		  char const *name, double *pts)
+		  char const *name, gnm_float *pts)
 {
 	double num;
 	char *end = NULL;
@@ -593,7 +599,7 @@ oo_parse_distance (GsfXMLIn *xin, xmlChar const *str,
 /* returns pts */
 static char const *
 oo_attr_distance (GsfXMLIn *xin, xmlChar const * const *attrs,
-		  int ns_id, char const *name, double *pts)
+		  int ns_id, char const *name, gnm_float *pts)
 {
 	g_return_val_if_fail (attrs != NULL, NULL);
 	g_return_val_if_fail (attrs[0] != NULL, NULL);
@@ -2940,7 +2946,7 @@ oo_style_prop_col_row (GsfXMLIn *xin, xmlChar const **attrs)
 		? "column-width" :  "row-height";
 	char const * const use_optimal = (state->cur_style.type == OO_STYLE_COL)
 		? "use-optimal-column-width" : "use-optimal-row-height";
-	double pts;
+	gnm_float pts;
 	gboolean auto_size;
 
 	g_return_if_fail (state->cur_style.col_rows != NULL);
@@ -3519,6 +3525,10 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 			style->style_props = g_slist_prepend
 				(style->style_props,
 				 oo_prop_new_int ("text-rotation-angle", tmp));
+		else if (NULL != oo_attr_distance (xin, attrs, OO_NS_FO, "font-size", &ftmp))
+			style->style_props = g_slist_prepend
+				(style->style_props,
+				 oo_prop_new_float ("font-size", ftmp));
 	}
 
 	if (draw_stroke_set && !default_style_has_lines_set)
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index f325d37..b068bcc 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -4133,7 +4133,12 @@ static void
 odf_write_gog_style_text (GnmOOExport *state, GOStyle const *style)
 {
 	int val = style->text_layout.angle;
-	odf_add_angle (state->xml,  STYLE "text-rotation-angle", val);
+	odf_add_angle (state->xml, STYLE "text-rotation-angle", val);
+
+	odf_add_pt (state->xml, FOSTYLE "font-size",
+		    pango_font_description_get_size (style->font.font->desc) 
+		    / (double)PANGO_SCALE);
+
 }
 
 static void
diff --git a/samples/chart-tests.gnumeric b/samples/chart-tests.gnumeric
index 060398e..b487a77 100644
Binary files a/samples/chart-tests.gnumeric and b/samples/chart-tests.gnumeric differ



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