Functions
gtk_font_chooser_get_font_family ()
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.
Returns
A PangoFontFamily representing the
selected font family, or NULL. The returned object is owned by fontchooser
and must not be modified or freed.
[nullable][transfer none]
Since: 3.2
gtk_font_chooser_get_font_face ()
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.
Returns
A PangoFontFace representing the
selected font group details, or NULL. The returned object is owned by
fontchooser
and must not be modified or freed.
[nullable][transfer none]
Since: 3.2
gtk_font_chooser_get_font_size ()
gint
gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser);
The selected font size.
Returns
A n integer representing the selected font size,
or -1 if no font size is selected.
Since: 3.2
gtk_font_chooser_get_font ()
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.
Returns
A string with the name
of the current font, or NULL if no font is selected. You must
free this string with g_free().
[nullable][transfer full]
Since: 3.2
gtk_font_chooser_set_font ()
void
gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
const gchar *fontname);
Sets the currently-selected font.
Since: 3.2
gtk_font_chooser_get_font_desc ()
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.
Since: 3.2
gtk_font_chooser_set_font_desc ()
void
gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser,
const PangoFontDescription *font_desc);
Sets the currently-selected font from font_desc
.
Since: 3.2
gtk_font_chooser_get_preview_text ()
gchar *
gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser);
Gets the text displayed in the preview area.
Returns
the text displayed in the
preview area.
[transfer full]
Since: 3.2
gtk_font_chooser_set_preview_text ()
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.
Since: 3.2
gtk_font_chooser_get_show_preview_entry ()
gboolean
gtk_font_chooser_get_show_preview_entry
(GtkFontChooser *fontchooser);
Returns whether the preview entry is shown or not.
Returns
TRUE if the preview entry is shown
or FALSE if it is hidden.
Since: 3.2
gtk_font_chooser_set_show_preview_entry ()
void
gtk_font_chooser_set_show_preview_entry
(GtkFontChooser *fontchooser,
gboolean show_preview_entry);
Shows or hides the editable preview entry.
Since: 3.2
gtk_font_chooser_set_font_map ()
void
gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser,
PangoFontMap *fontmap);
Sets a custom font map to use for this font chooser widget.
A custom font map can be used to present application-specific
fonts instead of or in addition to the normal system fonts.
Note that other GTK+ widgets will only be able to use the application-specific
font if it is present in the font map they use:
Since: 3.18
gtk_font_chooser_get_font_map ()
PangoFontMap *
gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser);
Gets the custom font map of this font chooser widget,
or NULL if it does not have one.
Since: 3.18
gtk_font_chooser_set_level ()
void
gtk_font_chooser_set_level (GtkFontChooser *fontchooser,
GtkFontChooserLevel level);
Sets the desired level of granularity for selecting fonts.
Since: 3.24
gtk_font_chooser_get_level ()
GtkFontChooserLevel
gtk_font_chooser_get_level (GtkFontChooser *fontchooser);
Returns the current level of granularity for selecting fonts.
Returns
the current granularity level
Since: 3.24
gtk_font_chooser_get_font_features ()
char *
gtk_font_chooser_get_font_features (GtkFontChooser *fontchooser);
Gets the currently-selected font features.
Returns
the currently selected font features
Since: 3.24
gtk_font_chooser_set_language ()
void
gtk_font_chooser_set_language (GtkFontChooser *fontchooser,
const char *language);
Sets the language to use for font features.
Since: 3.24
gtk_font_chooser_get_language ()
char *
gtk_font_chooser_get_language (GtkFontChooser *fontchooser);
Gets the language that is used for font features.
Returns
the currently selected language
Since: 3.24
Property Details
The “font” property
“font” gchar *
The font description as a string, e.g. "Sans Italic 12".
Owner: GtkFontChooser
Flags: Read / Write
Default value: "Sans 10"
The “font-features” property
“font-features” gchar *
The selected font features, in a format that is compatible with
CSS and with Pango attributes.
Owner: GtkFontChooser
Flags: Read
Default value: ""
Since: 3.22.30
The “language” property
“language” gchar *
The language for which the “font-features” were
selected, in a format that is compatible with CSS and with Pango
attributes.
Owner: GtkFontChooser
Flags: Read / Write
Default value: ""
Since: 3.22.30
The “level” property
“level” GtkFontChooserLevel
The level of granularity to offer for selecting fonts.
Owner: GtkFontChooser
Flags: Read / Write
Default value: GTK_FONT_CHOOSER_LEVEL_STYLE | GTK_FONT_CHOOSER_LEVEL_SIZE
Since: 3.22.30
The “preview-text” property
“preview-text” gchar *
The string with which to preview the font.
Owner: GtkFontChooser
Flags: Read / Write
Default value: "The quick brown fox jumps over the lazy dog."
The “show-preview-entry” property
“show-preview-entry” gboolean
Whether to show an entry to change the preview text.
Owner: GtkFontChooser
Flags: Read / Write
Default value: TRUE