Bug fix to GTK+ 1.2.8 font selection widget
- From: Guy Harris <gharris flashcom net>
- To: gtk-list gnome org
- Subject: Bug fix to GTK+ 1.2.8 font selection widget
- Date: Thu, 7 Sep 2000 23:05:28 -0700
I've uploaded to "ftp://ftp.gimp.org/incoming/" a patch to fix a bug in
the font selection box in GTK+ 1.2.8; it fixes
"gtk_font_selection_set_font_name()" to set the current row in the font
clist to the result of
gtk_clist_find_row_from_data(GTK_CLIST(fontsel->font_clist),
GINT_TO_POINTER (index));
rather than to "index" itself.
The index returned by "gtk_font_selection_find_font()", which is the
value of "index", is not necessarily the row number of the font in
question in the font clist, so, if "index" is used as the row number in
the clist, the selected font in the clist isn't necessarily the font
specified by the font name in the "gtk_font_selection_set_font_name()"
call, and, if "index" is greater than the number of rows in the clist,
no font is set at all.
The patch is "gtk-gharris-000907-0", with the appropriate two files
uploaded. I've attached the patch to this message as well.
If, as, and when there's a GTK+ 1.2.9, it might be nice to have that
problem fixed.
The fix doesn't apply to 1.3/2.0, as the font selection stuff is
different as a result of Pangoization; assuming, as I suspect is the
case, that the Pango calls in 1.3's "gtk_font_selection_set_font_name()"
don't have any effect on the font selection widget, I don't see any
calls in "gtk_font_selection_set_font_name()" to change the selected row
in the clist, so either I'm missing something or
"gtk_font_selection_set_font_name()" in 1.3 won't cause the new font to
be the one selected in the font clist, which I'd consider a bug.
--- gtk/gtkfontsel.c.dist Thu May 18 21:49:51 2000
+++ gtk/gtkfontsel.c Thu Sep 7 22:36:37 2000
@@ -3151,7 +3151,7 @@
const gchar *fontname)
{
gchar *family, *field;
- gint index, prop, size;
+ gint index, prop, size, row;
guint16 foundry, value;
gchar family_buffer[XLFD_MAX_FIELD_LEN];
gchar field_buffer[XLFD_MAX_FIELD_LEN];
@@ -3227,9 +3227,14 @@
/* Now find the best style match. */
fontsel->font_index = index;
- gtk_clist_select_row(GTK_CLIST(fontsel->font_clist), index, 0);
- if (GTK_WIDGET_MAPPED (fontsel->font_clist))
- gtk_clist_moveto(GTK_CLIST(fontsel->font_clist), index, -1, 0.5, 0);
+ row = gtk_clist_find_row_from_data(GTK_CLIST(fontsel->font_clist),
+ GINT_TO_POINTER (index));
+ if (row != -1)
+ {
+ gtk_clist_select_row(GTK_CLIST(fontsel->font_clist), row, 0);
+ if (GTK_WIDGET_MAPPED (fontsel->font_clist))
+ gtk_clist_moveto(GTK_CLIST(fontsel->font_clist), row, -1, 0.5, 0);
+ }
gtk_font_selection_show_available_styles (fontsel);
/* This will load the font. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]