[goffice] check whether the layout has a fontmap set before using it for measurements
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] check whether the layout has a fontmap set before using it for measurements
- Date: Sat, 27 Aug 2011 13:21:45 +0000 (UTC)
commit dce8cf5e46e239915ea3fc454ce414fe2c664eae
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sat Aug 27 07:20:00 2011 -0600
check whether the layout has a fontmap set before using it for measurements
2011-08-27 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/go-format.c (go_format_desired_width): check for fontmap
(go_format_get_logical_rect): ditto
ChangeLog | 5 +++++
goffice/utils/go-format.c | 14 ++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a17669a..0e0d89e 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_desired_width): check for fontmap
+ (go_format_get_logical_rect): ditto
+
+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
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index e95dcdf..18aaaa8 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -2518,13 +2518,16 @@ go_format_get_logical_rect (PangoRectangle *rect, GString *dst, PangoAttrList *a
{
GList *plist, *l;
PangoRectangle logical_rect = {0, 0, 0, 0};
+ PangoContext *context;
- if (layout == NULL) {
+ if (layout == NULL ||
+ (context = pango_layout_get_context (layout)) == NULL
+ || pango_context_get_font_map (context) == NULL) {
*rect = logical_rect;
return;
}
- plist = pango_itemize (pango_layout_get_context (layout), dst->str, start, length, attrs, NULL);
+ plist = pango_itemize (context, dst->str, start, length, attrs, NULL);
for (l = plist; l != NULL; l = l->next) {
PangoItem *pi = l->data;
PangoGlyphString *glyphs = pango_glyph_string_new ();
@@ -2554,11 +2557,14 @@ go_format_desired_width (PangoLayout *layout, PangoAttrList *attrs, int digits)
const gchar *strp = &(str[0]);
GList *plist, *l;
int width = 0;
+ PangoContext *context;
- if (layout == NULL)
+ if (layout == NULL ||
+ (context = pango_layout_get_context (layout)) == NULL
+ || pango_context_get_font_map (context) == NULL)
return 0;
- plist = pango_itemize (pango_layout_get_context (layout), strp, 0, 1, attrs, NULL);
+ plist = pango_itemize (context, strp, 0, 1, attrs, NULL);
for (l = plist; l != NULL; l = l->next) {
PangoItem *pi = l->data;
PangoGlyphString *glyphs = pango_glyph_string_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]