Gtk.FontChooser¶
interface
:::warning Deprecated since 4.10 This API is deprecated. :::
GtkFontChooser is an interface that can be implemented by widgets
for choosing fonts.
In GTK, the main objects that implement this interface are
FontChooserWidget, FontChooserDialog and
FontButton.
Methods¶
get_font¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the currently-selected font name.
Note that this can be a different string than what you set with
FontChooser.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.FontDescription.equal if you want to compare two
font descriptions.
get_font_desc¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the currently-selected font.
Note that this can be a different string than what you set with
FontChooser.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.FontDescription.equal if you want to compare two
font descriptions.
get_font_face¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the PangoFontFace representing the selected font group
details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns None.
get_font_family¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the PangoFontFamily representing the selected font family.
Font families are a collection of font faces.
If the selected font is not installed, returns None.
get_font_features¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the currently-selected font features.
The format of the returned string is compatible with the
CSS font-feature-settings property.
It can be passed to Pango.AttrFontFeatures.new.
get_font_map¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the custom font map of this font chooser widget,
or None if it does not have one.
get_font_size¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The selected font size.
get_language¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the language that is used for font features.
get_level¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns the current level of granularity for selecting fonts.
get_preview_text¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the text displayed in the preview area.
get_show_preview_entry¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns whether the preview entry is shown or not.
set_filter_func¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Adds a filter function that decides which fonts to display in the font chooser.
Parameters:
filter— aGtkFontFilterFunc
set_font¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the currently-selected font.
Parameters:
fontname— a font name like “Helvetica 12” or “Times Bold 18”
set_font_desc¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the currently-selected font from font_desc.
Parameters:
font_desc— aPangoFontDescription
set_font_map¶
:::warning Deprecated since 4.10 This API is deprecated. :::
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.
FcConfig *config;
PangoFontMap *fontmap;
config = FcInitLoadConfigAndFonts ();
FcConfigAppFontAddFile (config, my_app_font_file);
fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
gtk_font_chooser_set_font_map (font_chooser, fontmap);
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:
Parameters:
fontmap— aPangoFontMap
set_language¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the language to use for font features.
Parameters:
language— a language
set_level¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the desired level of granularity for selecting fonts.
Parameters:
level— the desired level of granularity
set_preview_text¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the text displayed in the preview area.
The text is used to show how the selected font looks.
Parameters:
text— the text to display in the preview area
set_show_preview_entry¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Shows or hides the editable preview entry.
Parameters:
show_preview_entry— whether to show the editable preview entry or not
Virtual methods¶
do_font_activated¶
do_get_font_face¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the PangoFontFace representing the selected font group
details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns None.
do_get_font_family¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the PangoFontFamily representing the selected font family.
Font families are a collection of font faces.
If the selected font is not installed, returns None.
do_get_font_map¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the custom font map of this font chooser widget,
or None if it does not have one.
do_get_font_size¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The selected font size.
do_set_filter_func¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Adds a filter function that decides which fonts to display in the font chooser.
Parameters:
filter— aGtkFontFilterFunc
do_set_font_map¶
:::warning Deprecated since 4.10 This API is deprecated. :::
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.
FcConfig *config;
PangoFontMap *fontmap;
config = FcInitLoadConfigAndFonts ();
FcConfigAppFontAddFile (config, my_app_font_file);
fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
gtk_font_chooser_set_font_map (font_chooser, fontmap);
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:
Parameters:
fontmap— aPangoFontMap
Properties¶
font¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The font description as a string, e.g. "Sans Italic 12".
font_desc¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The font description as a PangoFontDescription.
font_features¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The selected font features.
The format of the string is compatible with CSS and with Pango attributes.
language¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The language for which the font features were selected.
level¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The level of granularity to offer for selecting fonts.
preview_text¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The string with which to preview the font.
show_preview_entry¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Whether to show an entry to change the preview text.
Signals¶
font-activated¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Emitted when a font is activated.
This usually happens when the user double clicks an item, or an item is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.