[gnumeric] don't switch locale to write colours in LaTeX export [#694328]



commit 1597111b962c4fa9dc2bb96a981e21e554fd5e78
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Feb 20 23:25:45 2013 -0700

    don't switch locale to write colours in LaTeX export [#694328]
    
    2013-02-20  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * latex.c (latex2e_write_multicolumn_cell): don't switch locale
        to write colours. [#694328]

 plugins/html/ChangeLog |    5 +++++
 plugins/html/latex.c   |   14 +++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/plugins/html/ChangeLog b/plugins/html/ChangeLog
index f2d4797..d2e4dff 100644
--- a/plugins/html/ChangeLog
+++ b/plugins/html/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-20  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * latex.c (latex2e_write_multicolumn_cell): don't switch locale
+       to write colours. [#694328]
+
 2013-01-01  Morten Welinder  <terra gnome org>
 
        * html.c (cb_html_attrs_as_string): Don't use deprecated goffice
diff --git a/plugins/html/latex.c b/plugins/html/latex.c
index cc16005..85ec716 100644
--- a/plugins/html/latex.c
+++ b/plugins/html/latex.c
@@ -1031,11 +1031,15 @@ latex2e_write_multicolumn_cell (GsfOutput *output, GnmCell *cell, int start_col,
                        b = GO_COLOR_UINT_B (fore);
                }
                if (r != 0 || g != 0 || b != 0) {
-                       char *locale;
-                       locale = setlocale (LC_NUMERIC, "C");
-                       gsf_output_printf (output, "{\\color[rgb]{%.2f,%.2f,%.2f} ",
-                                          r/255.0, g/255.0, b/255.0);
-                       locale = setlocale (LC_NUMERIC, locale);
+                       gchar buffer[7] = {0};
+                       gsf_output_printf (output, "{\\color[rgb]{");
+                       g_ascii_formatd (buffer, 7, "%.2f",r/255.0);
+                       gsf_output_printf (output, "%s,", buffer);
+                       g_ascii_formatd (buffer, 7, "%.2f",g/255.0);
+                       gsf_output_printf (output, "%s,", buffer);
+                       g_ascii_formatd (buffer, 7, "%.2f",b/255.0);
+                       gsf_output_printf (output, "%s", buffer);
+                       gsf_output_printf (output, "} ");
                }
 
                /* Establish the font's style for the styles that can be addressed by LaTeX.


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