[gnumeric] .gnumeric: don't write font names for styles that have none.



commit c8a8aa46b0095d8a87a70ccd0ef605c5c468e7e8
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 14 22:06:13 2014 -0400

    .gnumeric: don't write font names for styles that have none.
    
    In practice that means for conditional styles.

 ChangeLog           |    5 +++++
 src/xml-sax-write.c |   11 ++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a18146..ca5adc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-14  Morten Welinder  <terra gnome org>
+
+       * src/xml-sax-write.c (xml_write_style): Don't write a font name
+       if we don't have any.
+
 2014-03-14  Jean Brefort  <jean brefort normalesup org>
 
        * src/gui-util.c (gnm_canvas_get_position): fix tooltip position. [#725941]
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index 2a3859c..93dec42 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -527,8 +527,6 @@ xml_write_style (GnmOutputXML *state, GnmStyle const *style)
            gnm_style_is_element_set (style, MSTYLE_FONT_UNDERLINE) ||
            gnm_style_is_element_set (style, MSTYLE_FONT_STRIKETHROUGH) ||
            gnm_style_is_element_set (style, MSTYLE_FONT_SCRIPT)) {
-               char const *fontname;
-
                gsf_xml_out_start_element (state->output, GNM "Font");
 
                if (gnm_style_is_element_set (style, MSTYLE_FONT_SIZE))
@@ -544,12 +542,11 @@ xml_write_style (GnmOutputXML *state, GnmStyle const *style)
                if (gnm_style_is_element_set (style, MSTYLE_FONT_SCRIPT))
                        gsf_xml_out_add_int (state->output, "Script", (int)gnm_style_get_font_script (style));
 
-               if (gnm_style_is_element_set (style, MSTYLE_FONT_NAME))
-                       fontname = gnm_style_get_font_name (style);
-               else /* backwards compatibility */
-                       fontname = "Helvetica";
+               if (gnm_style_is_element_set (style, MSTYLE_FONT_NAME)) {
+                       const char *fontname = gnm_style_get_font_name (style);
+                       gsf_xml_out_add_cstr (state->output, NULL, fontname);
+               }
 
-               gsf_xml_out_add_cstr (state->output, NULL, fontname);
                gsf_xml_out_end_element (state->output);
        }
 


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