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

rpms/libgal2/devel gal-2.4.2-fix-150458.patch, NONE, 1.1 gal-2.5.3-fix-150458.patch, NONE, 1.1 libgal2.spec, 1.35, 1.36



Author: dmalcolm

Update of /cvs/dist/rpms/libgal2/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv28200

Modified Files:
	libgal2.spec 
Added Files:
	gal-2.4.2-fix-150458.patch gal-2.5.3-fix-150458.patch 
Log Message:
Added initial versions of patches for 150458


gal-2.4.2-fix-150458.patch:
 e-cell-text.c             |  100 ++++++++++++++++++++++++++--------------------
 e-table-group-container.c |   31 +++++++++++---
 2 files changed, 81 insertions(+), 50 deletions(-)

--- NEW FILE gal-2.4.2-fix-150458.patch ---
--- gal-2.4.2/gal/e-table/e-table-group-container.c.fix-150458	2005-02-28 08:59:19.000000000 -0500
+++ gal-2.4.2/gal/e-table/e-table-group-container.c	2005-07-28 00:42:53.000000000 -0400
@@ -35,6 +35,7 @@
 #include "gal/widgets/e-unicode.h"
 #include "gal/e-text/e-text.h"
 #include "e-table-defines.h"
+#include <libgnomeprint/gnome-print-pango.h>
 
 #define TITLE_HEIGHT         16
 
@@ -1155,7 +1156,18 @@
 	GList *child;
 	EPrintable *child_printable;
 	gchar *string;
-	GnomeFont *font = gnome_font_find ("Helvetica", TEXT_HEIGHT);
+
+	PangoLayout *pl;
+
+	PangoFontDescription *font_desc = pango_font_description_from_string ("Helvetica");
+	#define MAGIC_SCALE_FACTOR (0.86)
+	pango_font_description_set_size (font_desc,
+					 TEXT_HEIGHT * MAGIC_SCALE_FACTOR * PANGO_SCALE );
+
+	pl = gnome_print_pango_create_layout (context);
+	pango_layout_set_font_description (pl, font_desc);
+	pango_layout_set_width (pl, -1); /* ensure no line-wrapping occurs */
+	pango_layout_set_indent (pl, 0);
 
 	child_printable = groupcontext->child_printable;
 	child = groupcontext->child;
@@ -1219,9 +1231,8 @@
 		if (gnome_print_clip(context) == -1)
 			/* FIXME */;
 
-		if (gnome_print_moveto(context, 2, yd - (TEXT_AREA_HEIGHT + gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2) == -1)
-			/* FIXME */;
-		if (gnome_print_setfont(context, font))
+		/* FIXME: get correct Y coordinate: */
+		if (gnome_print_moveto(context, 2, yd) == -1)
 			/* FIXME */;
 		if (groupcontext->etgc->ecol->text)
 			string = g_strdup_printf ("%s : %s (%d item%s)",
@@ -1234,9 +1245,13 @@
 						  child_node->string,
 						  (gint) child_node->count,
 						  child_node->count == 1 ? "" : "s");
-		if (gnome_print_show(context, string))
-			/* FIXME */;
+
+		pango_layout_set_text (pl, string, -1);
+
 		g_free(string);
+
+		gnome_print_pango_layout (context, pl);
+
 		if (gnome_print_grestore(context) == -1)
 			/* FIXME */;
 
@@ -1290,7 +1305,9 @@
 		g_object_unref (groupcontext->child_printable);
 	groupcontext->child_printable = child_printable;
 	groupcontext->child = child;
-			
+
+	pango_font_description_free (font_desc);
+	g_object_unref (G_OBJECT (pl));			
 }
 
 static gboolean
--- gal-2.4.2/gal/e-table/e-cell-text.c.fix-150458	2005-07-28 00:37:29.000000000 -0400
+++ gal-2.4.2/gal/e-table/e-cell-text.c	2005-07-28 00:41:59.000000000 -0400
@@ -56,6 +56,7 @@
 #include "e-table-tooltip.h"
 #include "gal/a11y/e-table/gal-a11y-e-cell-registry.h"
 #include "gal/a11y/e-table/gal-a11y-e-cell-text.h"
+#include <libgnomeprint/gnome-print-pango.h>
 
 #define d(x)
 #define DO_SELECTION 1
@@ -1285,23 +1286,18 @@
 
 #define FONT_NAME "Sans Regular"
 
-static GnomeFont *
+static PangoFontDescription *
 get_font_for_size (double h)
 {
-	GnomeFontFace *face;
-	GnomeFont *font;
-	double asc, desc, size;
+	PangoFontDescription *font_desc;
 
-	face = gnome_font_face_find (FONT_NAME);
+	font_desc = pango_font_description_from_string (FONT_NAME);
 
-	asc = gnome_font_face_get_ascender (face);
-	desc = abs (gnome_font_face_get_descender (face));
-	size = h * 1000 / (asc + desc);
-
-	font = gnome_font_find_closest (FONT_NAME, size);
-
-	g_object_unref (face);
-	return font;
+	#define MAGIC_SCALE_FACTOR (0.86)
+	pango_font_description_set_size (font_desc,
+					 h * MAGIC_SCALE_FACTOR * PANGO_SCALE );
+ 
+	return font_desc;
 }
 
 static void
@@ -1309,13 +1305,54 @@
 	   int model_col, int view_col, int row,
 	   double width, double height)
 {
-	GnomeFont *font = get_font_for_size (16);
+	PangoFontDescription *font_desc = get_font_for_size (16);
+	PangoLayout *pl;
 	char *string;
 	ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
-	double ty, ly, text_width;
+	double ty;
 	gboolean strikeout, underline;
 
+
 	string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
+
+	strikeout = ect->strikeout_column >= 0 && row >= 0 &&
+		e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
+	underline = ect->underline_column >= 0 && row >= 0 &&
+		e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
+
+
+	/* Set up PangoLayout: */
+	pl = gnome_print_pango_create_layout (context);
+	pango_layout_set_font_description (pl, font_desc);
+	pango_layout_set_text (pl, string, -1);
+	pango_layout_set_width (pl, -1); /* ensure no line-wrapping occurs */
+	pango_layout_set_indent (pl, 0);
+
+	if (strikeout || underline) {
+		PangoAttrList *attr_list;
+
+		attr_list = pango_attr_list_new ();
+
+		if (underline) {
+			PangoAttribute* attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+			attr->start_index = 0;
+			attr->end_index = strlen (string);
+			pango_attr_list_insert (attr_list,
+						attr);			
+		}
+
+		if (strikeout) {
+			PangoAttribute* attr = pango_attr_strikethrough_new (TRUE);
+			attr->start_index = 0;
+			attr->end_index = strlen (string);
+			pango_attr_list_insert (attr_list,
+						attr);			
+		}
+		pango_layout_set_attributes (pl,
+                                             attr_list);		
+		pango_attr_list_unref (attr_list);
+	}
+
 	gnome_print_gsave(context);
 	if (gnome_print_moveto(context, 2, 2) == -1)
 				/* FIXME */;
@@ -1330,38 +1367,15 @@
 	if (gnome_print_clip(context) == -1)
 				/* FIXME */;
 
-	ty = (height - gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2;
-	text_width = gnome_font_get_width_utf8 (font, string);
-
-	strikeout = ect->strikeout_column >= 0 && row >= 0 &&
-		e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
-	underline = ect->underline_column >= 0 && row >= 0 &&
-		e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
-
-	if (underline) {
-		ly = ty + gnome_font_get_underline_position (font);
-		gnome_print_newpath (context);
-		gnome_print_moveto (context, 2, ly);
-		gnome_print_lineto (context, MIN (2 + text_width, width - 2), ly);
-		gnome_print_setlinewidth (context, gnome_font_get_underline_thickness (font));
-		gnome_print_stroke (context);
-	}
-
-	if (strikeout) {
-		ly = ty + (gnome_font_get_ascender (font)  - gnome_font_get_underline_thickness (font))/ 2.0;
-		gnome_print_newpath (context);
-		gnome_print_moveto (context, 2, ly);
-		gnome_print_lineto (context, MIN (2 + text_width, width - 2), ly);
-		gnome_print_setlinewidth (context, gnome_font_get_underline_thickness (font));
-		gnome_print_stroke (context);
-	}
+	/* ty = (height - gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2; */
+	ty = 0; /* FIXME: get appropriate y coordinate */
 
 	gnome_print_moveto(context, 2, ty);
-	gnome_print_setfont(context, font);
-	gnome_print_show(context, string);
+	gnome_print_pango_layout (context, pl);
 	gnome_print_grestore(context);
 	e_cell_text_free_text(ect, string);
-	g_object_unref (font);
+	pango_font_description_free (font_desc);
+	g_object_unref (G_OBJECT (pl));
 }
 
 static gdouble

gal-2.5.3-fix-150458.patch:
 e-cell-text.c             |  100 ++++++++++++++++++++++++++--------------------
 e-table-group-container.c |   31 +++++++++++---
 2 files changed, 81 insertions(+), 50 deletions(-)

--- NEW FILE gal-2.5.3-fix-150458.patch ---
--- gal-2.5.3/gal/e-table/e-table-group-container.c.fix-150458	2005-04-29 10:16:03.000000000 -0400
+++ gal-2.5.3/gal/e-table/e-table-group-container.c	2005-07-28 00:52:56.000000000 -0400
@@ -27,6 +27,7 @@
 #include <gtk/gtk.h>
 #include <libgnome/libgnome.h>
 #include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
+#include <libgnomeprint/gnome-print-pango.h>
 
 #include "gal/e-text/e-text.h"
 #include "gal/util/e-i18n.h"
@@ -1159,7 +1160,18 @@
 	GList *child;
 	EPrintable *child_printable;
 	gchar *string;
-	GnomeFont *font = gnome_font_find ("Helvetica", TEXT_HEIGHT);
+
+	PangoLayout *pl;
+
+	PangoFontDescription *font_desc = pango_font_description_from_string ("Helvetica");
+	#define MAGIC_SCALE_FACTOR (0.86)
+	pango_font_description_set_size (font_desc,
+					 TEXT_HEIGHT * MAGIC_SCALE_FACTOR * PANGO_SCALE );
+
+	pl = gnome_print_pango_create_layout (context);
+	pango_layout_set_font_description (pl, font_desc);
+	pango_layout_set_width (pl, -1); /* ensure no line-wrapping occurs */
+	pango_layout_set_indent (pl, 0);
 
 	child_printable = groupcontext->child_printable;
 	child = groupcontext->child;
@@ -1223,9 +1235,8 @@
 		if (gnome_print_clip(context) == -1)
 			/* FIXME */;
 
-		if (gnome_print_moveto(context, 2, yd - (TEXT_AREA_HEIGHT + gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2) == -1)
-			/* FIXME */;
-		if (gnome_print_setfont(context, font))
+		/* FIXME: get correct Y coordinate: */
+		if (gnome_print_moveto(context, 2, yd) == -1)
 			/* FIXME */;
 		if (groupcontext->etgc->ecol->text)
 			string = g_strdup_printf ("%s : %s (%d item%s)",
@@ -1238,9 +1249,13 @@
 						  child_node->string,
 						  (gint) child_node->count,
 						  child_node->count == 1 ? "" : "s");
-		if (gnome_print_show(context, string))
-			/* FIXME */;
+
+		pango_layout_set_text (pl, string, -1);
+
 		g_free(string);
+
+		gnome_print_pango_layout (context, pl);
+
 		if (gnome_print_grestore(context) == -1)
 			/* FIXME */;
 
@@ -1294,7 +1309,9 @@
 		g_object_unref (groupcontext->child_printable);
 	groupcontext->child_printable = child_printable;
 	groupcontext->child = child;
-			
+
+	pango_font_description_free (font_desc);
+	g_object_unref (G_OBJECT (pl));			
 }
 
 static gboolean
--- gal-2.5.3/gal/e-table/e-cell-text.c.fix-150458	2005-07-28 00:51:11.000000000 -0400
+++ gal-2.5.3/gal/e-table/e-cell-text.c	2005-07-28 00:52:32.000000000 -0400
@@ -45,6 +45,7 @@
 #include <gtk/gtk.h>
 #include <libgnomecanvas/gnome-canvas.h>
 #include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
+#include <libgnomeprint/gnome-print-pango.h>
 
 #include "gal/a11y/e-table/gal-a11y-e-cell-registry.h"
 #include "gal/a11y/e-table/gal-a11y-e-cell-text.h"
@@ -1288,23 +1289,18 @@
 
 #define FONT_NAME "Sans Regular"
 
-static GnomeFont *
+static PangoFontDescription *
 get_font_for_size (double h)
 {
-	GnomeFontFace *face;
-	GnomeFont *font;
-	double asc, desc, size;
+	PangoFontDescription *font_desc;
 
-	face = gnome_font_face_find (FONT_NAME);
+	font_desc = pango_font_description_from_string (FONT_NAME);
 
-	asc = gnome_font_face_get_ascender (face);
-	desc = abs (gnome_font_face_get_descender (face));
-	size = h * 1000 / (asc + desc);
-
-	font = gnome_font_find_closest (FONT_NAME, size);
-
-	g_object_unref (face);
-	return font;
+	#define MAGIC_SCALE_FACTOR (0.86)
+	pango_font_description_set_size (font_desc,
+					 h * MAGIC_SCALE_FACTOR * PANGO_SCALE );
+ 
+	return font_desc;
 }
 
 static void
@@ -1312,13 +1308,54 @@
 	   int model_col, int view_col, int row,
 	   double width, double height)
 {
-	GnomeFont *font = get_font_for_size (16);
+	PangoFontDescription *font_desc = get_font_for_size (16);
+	PangoLayout *pl;
 	char *string;
 	ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
-	double ty, ly, text_width;
+	double ty;
 	gboolean strikeout, underline;
 
+
 	string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
+
+	strikeout = ect->strikeout_column >= 0 && row >= 0 &&
+		e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
+	underline = ect->underline_column >= 0 && row >= 0 &&
+		e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
+
+
+	/* Set up PangoLayout: */
+	pl = gnome_print_pango_create_layout (context);
+	pango_layout_set_font_description (pl, font_desc);
+	pango_layout_set_text (pl, string, -1);
+	pango_layout_set_width (pl, -1); /* ensure no line-wrapping occurs */
+	pango_layout_set_indent (pl, 0);
+
+	if (strikeout || underline) {
+		PangoAttrList *attr_list;
+
+		attr_list = pango_attr_list_new ();
+
+		if (underline) {
+			PangoAttribute* attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+			attr->start_index = 0;
+			attr->end_index = strlen (string);
+			pango_attr_list_insert (attr_list,
+						attr);			
+		}
+
+		if (strikeout) {
+			PangoAttribute* attr = pango_attr_strikethrough_new (TRUE);
+			attr->start_index = 0;
+			attr->end_index = strlen (string);
+			pango_attr_list_insert (attr_list,
+						attr);			
+		}
+		pango_layout_set_attributes (pl,
+                                             attr_list);		
+		pango_attr_list_unref (attr_list);
+	}
+
 	gnome_print_gsave(context);
 	if (gnome_print_moveto(context, 2, 2) == -1)
 				/* FIXME */;
@@ -1333,38 +1370,15 @@
 	if (gnome_print_clip(context) == -1)
 				/* FIXME */;
 
-	ty = (height - gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2;
-	text_width = gnome_font_get_width_utf8 (font, string);
-
-	strikeout = ect->strikeout_column >= 0 && row >= 0 &&
-		e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
-	underline = ect->underline_column >= 0 && row >= 0 &&
-		e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
-
-	if (underline) {
-		ly = ty + gnome_font_get_underline_position (font);
-		gnome_print_newpath (context);
-		gnome_print_moveto (context, 2, ly);
-		gnome_print_lineto (context, MIN (2 + text_width, width - 2), ly);
-		gnome_print_setlinewidth (context, gnome_font_get_underline_thickness (font));
-		gnome_print_stroke (context);
-	}
-
-	if (strikeout) {
-		ly = ty + (gnome_font_get_ascender (font)  - gnome_font_get_underline_thickness (font))/ 2.0;
-		gnome_print_newpath (context);
-		gnome_print_moveto (context, 2, ly);
-		gnome_print_lineto (context, MIN (2 + text_width, width - 2), ly);
-		gnome_print_setlinewidth (context, gnome_font_get_underline_thickness (font));
-		gnome_print_stroke (context);
-	}
+	/* ty = (height - gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2; */
+	ty = 0; /* FIXME: get appropriate y coordinate */
 
 	gnome_print_moveto(context, 2, ty);
-	gnome_print_setfont(context, font);
-	gnome_print_show(context, string);
+	gnome_print_pango_layout (context, pl);
 	gnome_print_grestore(context);
 	e_cell_text_free_text(ect, string);
-	g_object_unref (font);
+	pango_font_description_free (font_desc);
+	g_object_unref (G_OBJECT (pl));
 }
 
 static gdouble


Index: libgal2.spec
===================================================================
RCS file: /cvs/dist/rpms/libgal2/devel/libgal2.spec,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- libgal2.spec	25 Jul 2005 21:45:02 -0000	1.35
+++ libgal2.spec	28 Jul 2005 04:52:55 -0000	1.36
@@ -2,7 +2,7 @@
 
 Name: libgal2
 Version: 2.5.3
-Release: 1
+Release: 2
 Summary: The GNOME Application Library
 Group: System Environment/Libraries
 Epoch: 2
@@ -31,6 +31,9 @@
 # Part of fix for RH bug 154360:
 Patch103: gal-2.4.2-keypress.patch
 
+# Fix for RH bug 150458:
+Patch104: gal-2.5.3-fix-150458.patch
+
 %description
 A collection of GNOME widgets and utility functions.
 
@@ -50,6 +53,7 @@
 %patch101 -p1 -b .remove-preedit
 %patch102 -p1 -b .fix-157398
 %patch103 -p1 -b .keypress
+%patch104 -p1 -b .fix-150458
 
 %build
 %configure
@@ -87,6 +91,9 @@
 %{_datadir}/gtk-doc/html/gal/*
 
 %changelog
+* Thu Jul 28 2005 David Malcolm <dmalcolm redhat com> - 2:2.5.3-2
+- added patch to port ETable printing to use Pango (#150458)
+
 * Mon Jul 25 2005 David Malcolm <dmalcolm redhat com> - 2:2.5.3-1
 - 2.5.3
 - Update gal-major from 2.4 to 2.6


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