[gnumeric] xlsx: import super/subscript font information.



commit 160a62a8a6061610222a58fccbb21538ab52a2bf
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 10 12:01:05 2014 -0400

    xlsx: import super/subscript font information.

 NEWS                      |    2 +-
 plugins/excel/ChangeLog   |    2 ++
 plugins/excel/xlsx-read.c |   18 ++++++++++++++++++
 test/t6502-styles.pl      |    3 +--
 4 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index a0d45af..436be26 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Andreas:
 Morten:
        * Support volatile functions.  [#305798]
        * Improve testing.
-       * Export super/subscript fonts to xlsx.  [Part of #726035]
+       * Import/Export super/subscript fonts to xlsx.  [Part of #726035]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.12
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 7fde9a9..cdf11dd 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,7 @@
 2014-03-10  Morten Welinder  <terra gnome org>
 
+       * xlsx-read.c (xlsx_CT_vertAlign): Read super/subscript.
+
        * xlsx-write.c (xlsx_write_fonts): Save super/sub attribute.
 
 2014-03-05  Morten Welinder  <terra gnome org>
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 78762bc..36eb606 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -4109,6 +4109,23 @@ xlsx_CT_FontSize (GsfXMLIn *xin, xmlChar const **attrs)
                        gnm_style_set_font_size (state->style_accum, val);
 }
 static void
+xlsx_CT_vertAlign (GsfXMLIn *xin, xmlChar const **attrs)
+{
+       XLSXReadState *state = (XLSXReadState *)xin->user_state;
+       static EnumVal const types[] = {
+               { "subscript", GO_FONT_SCRIPT_SUB },
+               { "superscript", GO_FONT_SCRIPT_SUPER },
+               { NULL, 0 }
+       };
+       int val = GO_FONT_SCRIPT_STANDARD;
+
+       for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
+               if (attr_enum (xin, attrs, "val", types, &val))
+                       ; /* Nothing */
+
+       gnm_style_set_font_script (state->style_accum, val);
+}
+static void
 xlsx_font_uline (GsfXMLIn *xin, xmlChar const **attrs)
 {
        static EnumVal const types[] = {
@@ -4515,6 +4532,7 @@ GSF_XML_IN_NODE_FULL (START, STYLE_INFO, XL_NS_SS, "styleSheet", GSF_XML_NO_CONT
       GSF_XML_IN_NODE (FONT, FONT_EXTEND,    XL_NS_SS, "extend",    GSF_XML_NO_CONTENT, NULL, NULL),
       GSF_XML_IN_NODE (FONT, FONT_COLOR,     XL_NS_SS, "color",     GSF_XML_NO_CONTENT, &xlsx_font_color, 
NULL),
       GSF_XML_IN_NODE (FONT, FONT_SZ,       XL_NS_SS, "sz",        GSF_XML_NO_CONTENT, &xlsx_CT_FontSize, 
NULL),
+      GSF_XML_IN_NODE (FONT, FONT_SCRIPT,    XL_NS_SS, "vertAlign", GSF_XML_NO_CONTENT,        
&xlsx_CT_vertAlign, NULL),
       GSF_XML_IN_NODE (FONT, FONT_ULINE,     XL_NS_SS, "u",        GSF_XML_NO_CONTENT, &xlsx_font_uline, 
NULL),
       GSF_XML_IN_NODE (FONT, FONT_VERTALIGN, XL_NS_SS, "vertAlign", GSF_XML_NO_CONTENT, &xlsx_font_valign, 
NULL),
       GSF_XML_IN_NODE (FONT, FONT_SCHEME,    XL_NS_SS, "scheme",    GSF_XML_NO_CONTENT, NULL, NULL),
diff --git a/test/t6502-styles.pl b/test/t6502-styles.pl
index b488330..9d8a225 100755
--- a/test/t6502-styles.pl
+++ b/test/t6502-styles.pl
@@ -50,5 +50,4 @@ my $xls_pattern_filter = "$PERL -p -e 'use English; my \%m=(19,14,20,7,21,4,22,4
                 'format' => 'Gnumeric_Excel:xlsx',
                 'ext' => "xlsx",
                 'resize' => '1048576x16384',
-                'filter1' => $xls_pattern_filter,
-                'ignore_failure' => 1);
+                'filter1' => $xls_pattern_filter);


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