[goffice] Fix interpretation of marked-up scientific number format [#656056], and fraction rendering for unspe



commit d0f3a057f3d0cb22487f01a8d3d1db25afe8ad0b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Aug 8 10:31:56 2011 -0600

    Fix interpretation of marked-up scientific number format [#656056], and fraction rendering for unspecified denominators [#656043]
    
    2011-08-08  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_execute): n digits means atmast
    	10^n -1
    	(go_format_generate_scientific_str): use number of exponent digits
    	even if markup is used

 ChangeLog                 |    7 +++++++
 NEWS                      |    2 ++
 goffice/utils/go-format.c |   17 +++++++++--------
 3 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1efacc9..f440217 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-08  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* goffice/utils/go-format.c (go_format_execute): n digits means atmast
+	10^n -1
+	(go_format_generate_scientific_str): use number of exponent digits
+	even if markup is used
+
 2011-08-07  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/goc-graph.c (goc_graph_do_tooltip): fix when an axis
diff --git a/NEWS b/NEWS
index 17f846a..d2b06eb 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ goffice 0.9.0:
 Andreas:
 	* Use pango attributes for formatting. [#584380][#651561]
 	* Fix output of scientific number formats with EE to ODF.
+	* Fix interpretation of marked-up scientific number format. [#656056]
+	* Fix fraction rendering for unspecified denominators. [#656043]
 
 Jean:
 	* Port to gtk+-3.0.
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 778acb7..deee654 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -3120,7 +3120,7 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
 			} else {
 				int digits = *prg++;
 				int ni, di;
-				go_continued_fraction (aval, SUFFIX(go_pow10) (digits), &ni, &di);
+				go_continued_fraction (aval, SUFFIX(go_pow10) (digits) - 1, &ni, &di);
 				fraction.n = ni;
 				fraction.d = di;
 			}
@@ -5239,6 +5239,7 @@ go_format_generate_scientific_str (GString *dst, GOFormatDetails const *details)
 	/* Maximum not terribly important. */
 	int step = CLAMP (details->exponent_step, 1, 10);
 	int num_decimals = CLAMP (details->num_decimals, 0, MAX_DECIMALS);
+	int digits;
 
 	go_string_append_c_n (dst, '#', step - 1);
 	if (details->simplify_mantissa)
@@ -5252,13 +5253,13 @@ go_format_generate_scientific_str (GString *dst, GOFormatDetails const *details)
 	}
 
 	if (details->use_markup)
-		g_string_append (dst, "EE0");
-	else {
-		/* Maximum not terribly important. */
-		int digits = CLAMP (details->exponent_digits, 1, 10);
-		g_string_append (dst, "E+");
-		go_string_append_c_n (dst, '0', digits);
-	}
+		g_string_append_c (dst, 'E');
+
+	/* Maximum not terribly important. */
+	digits = CLAMP (details->exponent_digits, 1, 10);
+	g_string_append (dst, "E+");
+	go_string_append_c_n (dst, '0', digits);
+	
 }
 #endif
 



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