[gnumeric] Read/write rich-text font-size from ODF files. [#759983]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Read/write rich-text font-size from ODF files. [#759983]
- Date: Wed, 30 Dec 2015 05:24:06 +0000 (UTC)
commit 68fe436ed60a0651e94dc643a008296a09c10b06
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Tue Dec 29 22:23:39 2015 -0700
Read/write rich-text font-size from ODF files. [#759983]
2015-12-29 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_attrs_as_string): handle font size
(odf_write_character_styles): write font size styles
NEWS | 2 +-
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-write.c | 25 ++++++++++++++++++++++++-
3 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index df806f4..d9a3b9d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
Gnumeric 1.12.27
Andreas:
- * Read rich-text font-size from ODF files. [part of #759983]
+ * Read/write rich-text font-size from ODF files. [#759983]
Morten:
* Teach ssconvert to split sheets into separate .txt files [#694408]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index aaf352f..530a8af 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
2015-12-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_attrs_as_string): handle font size
+ (odf_write_character_styles): write font size styles
+
+2015-12-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (od_style_prop_text): read font-size
2015-12-28 Morten Welinder <terra gnome org>
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 9aebfd8..b2b6f26 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -109,6 +109,8 @@
#define CALCEXT "calcext:"
#define GNMSTYLE "gnm:" /* We use this for attributes and elements not supported by ODF */
+#define MAX_FONT_SIZE 144 /* The largest font size we are storing at the moment */
+
typedef struct {
GsfXMLOut *xml;
GsfOutfile *outfile;
@@ -435,7 +437,18 @@ odf_attrs_as_string (GnmOOExport *state, PangoAttribute *a)
case PANGO_ATTR_FAMILY :
break; /* ignored */
case PANGO_ATTR_SIZE :
- break; /* ignored */
+ {
+ char * str;
+ gint size = ((PangoAttrInt *)a)->value/PANGO_SCALE;
+ if (size > MAX_FONT_SIZE)
+ size = MAX_FONT_SIZE;
+ str = g_strdup_printf ("AC-size%i", size);
+ spans += 1;
+ gsf_xml_out_start_element (state->xml, TEXT "span");
+ gsf_xml_out_add_cstr (state->xml, TEXT "style-name", str);
+ g_free (str);
+ }
+ break;
case PANGO_ATTR_RISE:
gsf_xml_out_start_element (state->xml, TEXT "span");
if (((PangoAttrInt *)a)->value != 0) {
@@ -1864,6 +1877,16 @@ odf_write_character_styles (GnmOOExport *state)
gsf_xml_out_end_element (state->xml); /* </style:style> */
g_free (str);
}
+ for (i = 1; i <= MAX_FONT_SIZE; i+=1) {
+ char * str = g_strdup_printf ("AC-size%i", i);
+ odf_start_style (state->xml, str, "text");
+ gsf_xml_out_start_element (state->xml, STYLE "text-properties");
+ odf_add_pt (state->xml, FOSTYLE "font-size", (double) i);
+ odf_add_pt (state->xml, STYLE "font-size-asian", (double) i);
+ gsf_xml_out_end_element (state->xml); /* </style:text-properties> */
+ gsf_xml_out_end_element (state->xml); /* </style:style> */
+ g_free (str);
+ }
odf_start_style (state->xml, "AC-italic", "text");
gsf_xml_out_start_element (state->xml, STYLE "text-properties");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]