[goffice] make denominator simplification of pi-fractions slightly less eager



commit a90ab50ea1c8267351cf05bfb8d0ebc361920ced
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Sep 6 15:58:57 2011 -0600

     make denominator simplification of pi-fractions slightly less eager
    
    2011-09-06  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_parse_number_fraction): make
    	denominator simplification slightly less eager
    	(go_format_execute): ditto

 ChangeLog                 |    6 ++++++
 goffice/utils/go-format.c |   10 +++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3b81925..17e628f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-09-06  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* goffice/utils/go-format.c (go_format_parse_number_fraction): make
+	denominator simplification slightly less eager
+	(go_format_execute): ditto
+
+2011-09-06  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* goffice/utils/go-format.c (go_format_parse_number_E): make sure to
 	fail on '00E00' and '00E +00'
 	(go_format_execute): keep the leading whitespace
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index baf68ba..fb20d4e 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -2107,7 +2107,7 @@ go_format_parse_number_fraction (GOFormatParseState *pstate)
 	if (pi_scale) {
 		if (!inhibit_blank)
 			ADD_OP (OP_NUM_FRACTION_BLANK_PI);
-		if (!inhibit_blank_denom)
+		if (!inhibit_blank_denom && !inhibit_blank_whole)
 			ADD_OP (OP_NUM_FRACTION_SIMPLIFY_PI);
 		if (!inhibit_blank_numerator)
 			ADD_OP (OP_NUM_FRACTION_SIMPLIFY_NUMERATOR_PI);
@@ -3671,9 +3671,12 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
 
 #ifdef ALLOW_PI_SLASH
 		case OP_NUM_FRACTION_SIMPLIFY_PI:
-			if (!fraction.blanked && fraction.d == 1)
+			if (!fraction.blanked && fraction.d == 1 &&  
+			    fraction.w == 0) {
 				blank_characters (dst, attrs, fraction.denominator_start - 1,
 						  2, layout);
+				fraction.denom_blanked = TRUE;
+			}
 			break;
 #endif
 #ifdef ALLOW_DENOM_REMOVAL
@@ -3699,7 +3702,8 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
 
 #ifdef ALLOW_PI_SLASH
 		case OP_NUM_FRACTION_SIMPLIFY_NUMERATOR_PI:
-			if (!fraction.blanked && (fraction.n == 1 || fraction.n == -1)) {
+			if (!fraction.blanked && 
+			    (fraction.n == 1 || fraction.n == -1)) {
 				/* Remove "1".  */
 				gsize p = fraction.nominator_start;
 				gsize length = fraction.denominator_start - p - 1 -



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