|  |  |  | GTK+ 3 Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Prerequisites | Known Implementations | Properties | Signals | ||||
#include <gtk/gtk.h>
                    GtkFontChooser;
PangoFontFamily *   gtk_font_chooser_get_font_family    (GtkFontChooser *fontchooser);
PangoFontFace *     gtk_font_chooser_get_font_face      (GtkFontChooser *fontchooser);
gint                gtk_font_chooser_get_font_size      (GtkFontChooser *fontchooser);
gchar *             gtk_font_chooser_get_font           (GtkFontChooser *fontchooser);
void                gtk_font_chooser_set_font           (GtkFontChooser *fontchooser,
                                                         const gchar *fontname);
PangoFontDescription * gtk_font_chooser_get_font_desc   (GtkFontChooser *fontchooser);
void                gtk_font_chooser_set_font_desc      (GtkFontChooser *fontchooser,
                                                         const PangoFontDescription *font_desc);
gchar *             gtk_font_chooser_get_preview_text   (GtkFontChooser *fontchooser);
void                gtk_font_chooser_set_preview_text   (GtkFontChooser *fontchooser,
                                                         const gchar *text);
gboolean            gtk_font_chooser_get_show_preview_entry
                                                        (GtkFontChooser *fontchooser);
void                gtk_font_chooser_set_show_preview_entry
                                                        (GtkFontChooser *fontchooser,
                                                         gboolean show_preview_entry);
gboolean            (*GtkFontFilterFunc)                (const PangoFontFamily *family,
                                                         const PangoFontFace *face,
                                                         gpointer data);
void                gtk_font_chooser_set_filter_func    (GtkFontChooser *fontchooser,
                                                         GtkFontFilterFunc filter,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy);
GtkFontChooser is implemented by GtkFontButton, GtkFontChooserDialog and GtkFontChooserWidget.
"font" gchar* : Read / Write "font-desc" PangoFontDescription* : Read / Write "preview-text" gchar* : Read / Write "show-preview-entry" gboolean : Read / Write
GtkFontChooser is an interface that can be implemented by widgets displaying the list of fonts. In GTK+, the main objects that implement this interface are GtkFontChooserWidget, GtkFontChooserDialog and GtkFontButton.
PangoFontFamily *   gtk_font_chooser_get_font_family    (GtkFontChooser *fontchooser);
Gets the PangoFontFamily representing the selected font family. Font families are a collection of font faces.
If the selected font is not installed, returns NULL.
| 
 | a GtkFontChooser | 
| Returns : | A PangoFontFamily representing the
selected font family, or NULL. The returned object is owned byfontchooserand must not be modified or freed. [transfer none] | 
Since 3.2
PangoFontFace *     gtk_font_chooser_get_font_face      (GtkFontChooser *fontchooser);
Gets the PangoFontFace representing the selected font group details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns NULL.
| 
 | a GtkFontChooser | 
| Returns : | A PangoFontFace representing the
selected font group details, or NULL. The returned object is owned byfontchooserand must not be modified or freed. [transfer none] | 
Since 3.2
gint                gtk_font_chooser_get_font_size      (GtkFontChooser *fontchooser);
The selected font size.
| 
 | a GtkFontChooser | 
| Returns : | A n integer representing the selected font size, or -1 if no font size is selected. | 
Since 3.2
gchar *             gtk_font_chooser_get_font           (GtkFontChooser *fontchooser);
Gets the currently-selected font name.
Note that this can be a different string than what you set with
gtk_font_chooser_set_font(), as the font chooser widget may
normalize font names and thus return a string with a different
structure. For example, "Helvetica Italic Bold 12" could be
normalized to "Helvetica Bold Italic 12".
Use pango_font_description_equal() if you want to compare two
font descriptions.
| 
 | a GtkFontChooser | 
| Returns : | A string with the name
of the current font, or NULLif  no font is selected. You must
free this string withg_free(). [transfer full][allow-none] | 
Since 3.2
void gtk_font_chooser_set_font (GtkFontChooser *fontchooser,const gchar *fontname);
Sets the currently-selected font.
| 
 | a GtkFontChooser | 
| 
 | a font name like "Helvetica 12" or "Times Bold 18" | 
Since 3.2
PangoFontDescription * gtk_font_chooser_get_font_desc   (GtkFontChooser *fontchooser);
Gets the currently-selected font.
Note that this can be a different string than what you set with
gtk_font_chooser_set_font(), as the font chooser widget may
normalize font names and thus return a string with a different
structure. For example, "Helvetica Italic Bold 12" could be
normalized to "Helvetica Bold Italic 12".
Use pango_font_description_equal() if you want to compare two
font descriptions.
| 
 | a GtkFontChooser | 
| Returns : | A PangoFontDescription for the
current font, or NULLif  no font is selected. [transfer full][allow-none] | 
Since 3.2
void gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser,const PangoFontDescription *font_desc);
Sets the currently-selected font from font_desc.
| 
 | a GtkFontChooser | 
| 
 | a PangoFontDescription | 
Since 3.2
gchar *             gtk_font_chooser_get_preview_text   (GtkFontChooser *fontchooser);
Gets the text displayed in the preview area.
| 
 | a GtkFontChooser | 
| Returns : | the text displayed in the preview area. [transfer full] | 
Since 3.2
void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser,const gchar *text);
Sets the text displayed in the preview area.
The text is used to show how the selected font looks.
| 
 | a GtkFontChooser | 
| 
 | the text to display in the preview area. [transfer none] | 
Since 3.2
gboolean            gtk_font_chooser_get_show_preview_entry
                                                        (GtkFontChooser *fontchooser);
Returns whether the preview entry is shown or not.
| 
 | a GtkFontChooser | 
| Returns : | TRUEif the preview entry is shown
orFALSEif it is hidden. | 
Since 3.2
void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser,gboolean show_preview_entry);
Shows or hides the editable preview entry.
| 
 | a GtkFontChooser | 
| 
 | whether to show the editable preview entry or not | 
Since 3.2
gboolean (*GtkFontFilterFunc) (const PangoFontFamily *family,const PangoFontFace *face,gpointer data);
The type of function that is used for deciding what fonts get
shown in a GtkFontChooser. See gtk_font_chooser_set_filter_func().
| 
 | a PangoFontFamily | 
| 
 | a PangoFontFace belonging to family | 
| 
 | user data passed to gtk_font_chooser_set_filter_func(). [closure] | 
| Returns : | TRUEif the font should be displayed | 
void gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser,GtkFontFilterFunc filter,gpointer user_data,GDestroyNotify destroy);
Adds a filter function that decides which fonts to display in the font chooser.
| 
 | a GtkFontChooser | 
| 
 | a GtkFontFilterFunc, or NULL. [allow-none] | 
| 
 | data to pass to filter | 
| 
 | function to call to free datawhen it is no longer needed | 
Since 3.2
"font" property"font" gchar* : Read / Write
The font description as a string, e.g. "Sans Italic 12".
Default value: "Sans 10"
"font-desc" property"font-desc" PangoFontDescription* : Read / Write
The font description as a PangoFontDescription.
"preview-text" property"preview-text" gchar* : Read / Write
The string with which to preview the font.
Default value: "The quick brown fox jumps over the lazy dog."
"show-preview-entry" property"show-preview-entry" gboolean : Read / Write
Whether to show an entry to change the preview text.
Default value: TRUE
"font-activated" signalvoid                user_function                      (GtkFontChooser *fontchooser,
                                                        gchar          *arg1,
                                                        gpointer        user_data)        : Run First