GNOME Bugzilla – Bug 332756
docs for GtkFontSelection does not mention that it must be mapped to work
Last modified: 2006-02-27 18:20:09 UTC
Documentation Section: GTK+ Reference Manual, GtkFontSelection To set the font which is initially selected, use gtk_font_selection_set_font_name(). To get the selected font use gtk_font_selection_get_font() or gtk_font_selection_get_font_name(). Correct version: After the widget is assigned a screen (i.e. inserted into a top-level window): To set the font which is initially selected, use gtk_font_selection_set_font_name(). To get the selected font use gtk_font_selection_get_font() or gtk_font_selection_get_font_name(). Note that the font name returned by gtk_font_selection_get_font_name() is normalized so it may not be exactly the same string as set by gtk_font_selection_set_font_name(). Use pango_font_description_equal() for testing if the names returned by this call are equal. Other information:
This came up during LSB testing; they assumed that gtk_font_selection_set_font() would work (i.e. return TRUE) on an unattached GtkFontSelection, but it doesn't. GtkFontSelection won't populate the family_list until it gets its screen set. We should document this, and also put a g_return_val_if_fail (gtk_widget_has_screen (fs), FALSE) in gtk_font_selection_set_font().
I meant set_font_name(), of course.
Fixed in the HEAD branch. 2006-02-27 Federico Mena Quintero <federico@novell.com> * gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Check that the fontsel has a screen assigned before doing anything. This will at least warn the caller of what is wrong, since we only populate the family_list until we get a screen. Also, put the reference docs here. Fixes bug #332756. (gtk_font_selection_dialog_get_font_name): Document this here. (gtk_font_selection_get_font_name): Document this here; mention that the font names get normalized, so the result of this function may not be the same as what you set with gtk_font_selection_set_font_name().