Ethereal-dev: [Ethereal-dev] [PATCH] Fix for text width with gtk2

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Pavel Roskin <proski@xxxxxxx>
Date: Thu, 13 Feb 2003 15:05:48 -0500 (EST)
Hello!

This patch fixes calulating text width with gtk2.  It fixes all warnings
that look like this:

(ethereal:30157): Gdk-CRITICAL **: file gdkfont.c: line 72
(gdk_string_width): assertion `font != NULL' failed

Also, the width of the "source" and "destination" columns becomes wrong
after the packets are captured.  Pictures "before" and "after" can be
found here: http://www.red-bean.com/~proski/pictures/ethereal/

The fix is against today's CVS:

==================================
--- gtk/main.c
+++ gtk/main.c
@@ -1039,7 +1039,7 @@ set_plist_font(PangoFontDescription *fon
 			get_column_longest_string(get_column_format(i)));
 #else
 		cfile.cinfo.col_width[i] =
-                    gdk_string_width(gdk_font_from_description(font),
+                    gdk_string_width(gtk_style_get_font(packet_list->style),
 			get_column_longest_string(get_column_format(i)));
 #endif
 	}
==================================

I'm using Red Hat Linux 8.0 with gtk-2.0.6.  I have no idea why
gdk_font_from_description() doesn't work for me.

On the other hand, gtk_style_get_font() is already used in
gtk/stream_prefs.c, so it should be OK.

-- 
Regards,
Pavel Roskin