[gnumeric] GnmFont: remove pango.font member.



commit 5e012e40300dec4daee0d957feef2a1af636d2c9
Author: Morten Welinder <terra gnome org>
Date:   Thu Sep 3 21:28:07 2009 -0400

    GnmFont: remove pango.font member.

 ChangeLog        |    2 ++
 src/style-font.h |    3 ---
 src/style.c      |   16 ++++++++--------
 3 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7c7e7fd..719b3cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-09-03  Morten Welinder  <terra gnome org>
 
+	* src/style-font.h (GnmFont): Remove unused pango.font.
+
 	* configure.in (libgoffice): Require 0.7.12 for GPS_* change.
 
 2009-09-03  Jean Brefort  <jean brefort normalesup org>
diff --git a/src/style-font.h b/src/style-font.h
index d4c0c9f..097b674 100644
--- a/src/style-font.h
+++ b/src/style-font.h
@@ -17,9 +17,6 @@ struct _GnmFont {
 		GOFont const *font;
 		GOFontMetrics *metrics;
 	} go;
-	struct {
-		PangoFont *font;
-	} pango;
 
 	unsigned int is_bold : 1;
 	unsigned int is_italic : 1;
diff --git a/src/style.c b/src/style.c
index db76530..a3e374b 100644
--- a/src/style.c
+++ b/src/style.c
@@ -102,6 +102,7 @@ style_font_new_simple (PangoContext *context,
 	font = (GnmFont *) g_hash_table_lookup (style_font_hash, &key);
 	if (font == NULL) {
 		PangoFontDescription *desc;
+		PangoFont *pango_font;
 
 		if (g_hash_table_lookup (style_font_negative_hash, &key))
 			return NULL;
@@ -124,17 +125,17 @@ style_font_new_simple (PangoContext *context,
 			italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
 		pango_font_description_set_size (desc, size_pts * PANGO_SCALE);
 
-		font->pango.font = pango_context_load_font (context, desc);
-		if (font->pango.font == NULL) {
+		pango_font = pango_context_load_font (context, desc);
+		if (pango_font == NULL) {
 			/* if we fail, try to be smart and map to something similar */
 			char const *sub = get_substitute_font (font_name);
 			if (sub != NULL) {
 				pango_font_description_set_family (desc, font_name);
-				font->pango.font = pango_context_load_font (context,
+				pango_font = pango_context_load_font (context,
 									    desc);
 			}
 
-			if (font->pango.font == NULL) {
+			if (pango_font == NULL) {
 				pango_font_description_free (desc);
 				g_hash_table_insert (style_font_negative_hash,
 						     font, font);
@@ -142,6 +143,9 @@ style_font_new_simple (PangoContext *context,
 			}
 		}
 
+		if (pango_font)
+			g_object_unref (pango_font);
+
 		font->go.font = go_font_new_by_desc (desc);
 		font->go.metrics = go_font_metrics_new (context, font->go.font);
 		g_hash_table_insert (style_font_hash, font, font);
@@ -232,10 +236,6 @@ gnm_font_unref (GnmFont *sf)
 	if (sf->ref_count != 0)
 		return;
 
-	if (sf->pango.font != NULL) {
-		g_object_unref (G_OBJECT (sf->pango.font));
-		sf->pango.font = NULL;
-	}
 	if (sf->go.font) {
 		go_font_unref (sf->go.font);
 		sf->go.font = NULL;



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