[goffice] Fix fraction rendering. [657400]



commit 3394f382cbed0680b96ff1f30893040c32b88250
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Aug 26 01:21:48 2011 -0600

    Fix fraction rendering. [657400]
    
    2011-08-26  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_parse_number_fraction): write
    	OP_NUM_VAL_SIGN
    	(go_format_execute): keep the sign attached to val

 ChangeLog                 |    6 ++++++
 NEWS                      |    2 +-
 goffice/utils/go-format.c |   15 +++++----------
 3 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8594655..4fa567b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-08-26  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* goffice/utils/go-format.c (go_format_parse_number_fraction): write
+	OP_NUM_VAL_SIGN
+	(go_format_execute): keep the sign attached to val
+
+2011-08-26  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* goffice/utils/go-format.c (blank_characters): also remove the characters
 	themselves
 	(go_format_execute): move code to blank_characters; erase rather
diff --git a/NEWS b/NEWS
index 9323981..ae9f1c4 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ 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. [#656043][#657288][#657379]
+	* Fix fraction rendering. [#656043][#657288][#657379][657400]
 	* Fix date format on Windows. [#655573]
 	* Extend encoding specification from file-openers to plugin services.
 	* Improve the scientific number formats selector. [#657187][#623847]
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 45984c1..863c3b4 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -107,7 +107,7 @@
 
 /* ------------------------------------------------------------------------- */
 
-#undef DEBUG_PROGRAMS
+#define DEBUG_PROGRAMS
 #undef DEBUG_REF_COUNT
 
 /***************************************************************************/
@@ -1945,6 +1945,8 @@ go_format_parse_number_fraction (GOFormatParseState *pstate)
 	else
 		ADD_OP (MIN (10, denominator_digits));
 
+	ADD_OP (OP_NUM_VAL_SIGN);
+
 	if (tno_endwhole != -1) {
 		ADD_OP (OP_NUM_FRACTION_WHOLE);
 		if (!go_format_parse_number_new_1 (prg, pstate,
@@ -2613,11 +2615,11 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
 	gboolean digit_count = 0;
 	int exponent = 0;
 	struct {
-		DOUBLE w, n, d;
+		DOUBLE w, n, d, val;
 		int digits;
 		gsize whole_start, nominator_start, denominator_start;
 		gboolean blanked;
-	} fraction = {0., 0., 0., 0, 0, 0, 0, FALSE};
+	} fraction = {0., 0., 0., 0., 0, 0, 0, 0, FALSE};
 	char *oldlocale = NULL;
 	PangoAttrList *attrs = NULL;
 
@@ -3260,13 +3262,6 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
 			if (!wp)
 				fraction.n += fraction.d * fraction.w;
 
-			if (val < 0) {
-				if (wp)
-					fraction.w = 0 - fraction.w;
-				else
-					fraction.n = 0 - fraction.n;
-			}
-
 			break;
 		}
 



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