[goffice] GOFormat: fix rendering of "...E-xx"



commit 4368257b8912f4ed1696298f42a0b7d24addc988
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 29 21:41:45 2022 -0400

    GOFormat: fix rendering of "...E-xx"
    
    The "-" should become a unicode minus, but didn't in certain circumstances.

 NEWS                      |  3 +++
 goffice/utils/go-format.c | 10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 679df810..3765e560 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.10.53:
 
+Morten:
+       * Fix problem rendering "...E-xx" numbers.  [#60]
+
 --------------------------------------------------------------------------
 goffice 0.10.52:
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 70a5b88c..01f9ef45 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -4806,6 +4806,12 @@ go_format_measure_strlen (const GString *str,
                        convert_sign (str, (i), num_shape, shape_flags); \
        } while (0)
 
+#define HANDLE_ESIGN(i) do {                   \
+       const char *e = strchr (str->str, 'E'); \
+       if (e)                                  \
+               HANDLE_SIGN (e - str->str + 1); \
+} while (0)
+
 
 #define HANDLE_NUMERAL_SHAPE                                           \
        do {                                                            \
@@ -4975,6 +4981,7 @@ SUFFIX(go_render_general) (PangoLayout *layout, GString *str,
                go_dtoa (str, "=!^" FORMAT_G, val);
                HANDLE_NUMERAL_SHAPE;
                HANDLE_SIGN (0);
+               HANDLE_ESIGN ();
                SETUP_LAYOUT;
                if (col_width == -1 || measure (str, layout) <= col_width)
                        return;
@@ -5112,8 +5119,7 @@ SUFFIX(go_render_general) (PangoLayout *layout, GString *str,
                        go_dtoa (str, "=^.0" FORMAT_E, val);
                        HANDLE_NUMERAL_SHAPE;
                        HANDLE_SIGN (0);
-                       epos = strchr (str->str, 'E') - str->str;
-                       HANDLE_SIGN (epos + 1);
+                       HANDLE_ESIGN ();
                        SETUP_LAYOUT;
                        if (!rounds_to_0)
                                return;


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