[goffice] Handle NULL layout s in fraction format rendering.



commit fd8bf52f363be0d32c1547ffe5cc52e24e68ff67
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Aug 27 02:26:59 2011 -0600

    Handle NULL layout s in fraction format rendering.
    
    2011-08-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_get_logical_rect): handle NULL layout
    	(go_format_desired_width): ditto

 ChangeLog                 |    5 +++++
 goffice/utils/go-format.c |   10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 03bc546..a17669a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-27  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* goffice/utils/go-format.c (go_format_get_logical_rect): handle NULL layout
+	(go_format_desired_width): ditto
+
+2011-08-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* goffice/utils/formats.c (_go_currency_date_format_init): ISO 8601 should
 	be with the other date-time formats
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 3f1d511..e95dcdf 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -2517,13 +2517,18 @@ go_format_get_logical_rect (PangoRectangle *rect, GString *dst, PangoAttrList *a
 			    int length, PangoLayout *layout)
 {
 	GList *plist, *l;
+	PangoRectangle logical_rect = {0, 0, 0, 0};
+
+	if (layout == NULL) {
+		*rect = logical_rect;
+		return;
+	} 
 	
 	plist = pango_itemize (pango_layout_get_context (layout), dst->str, start, length, attrs, NULL);
 	for (l = plist; l != NULL; l = l->next) {
 		PangoItem *pi = l->data;
 		PangoGlyphString *glyphs = pango_glyph_string_new ();
 		PangoRectangle ink_rect;
-		PangoRectangle logical_rect;
 		
 		pango_shape (dst->str + pi->offset, pi->length, &pi->analysis, glyphs);
 		pango_glyph_string_extents (glyphs,
@@ -2550,6 +2555,9 @@ go_format_desired_width (PangoLayout *layout, PangoAttrList *attrs, int digits)
 	GList *plist, *l;
 	int width = 0;
 
+	if (layout == NULL)
+		return 0;
+
 	plist = pango_itemize (pango_layout_get_context (layout), strp, 0, 1, attrs, NULL);
 	for (l = plist; l != NULL; l = l->next) {
 		PangoItem *pi = l->data;



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