gtk.font_chooser_mixin
Module for [FontChooser] interface mixin
Templates 2
#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. The GtkFontChooser interface has been introducted in GTK+ 3.2.
Get font property.
Returns
Set font property.
Parameters
propval | The font description as a string, e.g. "Sans Italic 12". |
Get fontDesc property.
Returns
Set fontDesc property.
Parameters
propval | The font description as a #PangoFontDescription. |
Get fontFeatures property.
Returns
CSS and with Pango attributes.
Get language property.
Returns
selected, in a format that is compatible with CSS and with Pango attributes.
Set language property.
Parameters
propval | The language for which the #GtkFontChooser:font-features were selected, in a format that is compatible with CSS and with Pango attributes. |
Get level property.
Returns
Set level property.
Parameters
propval | The level of granularity to offer for selecting fonts. |
Get previewText property.
Returns
Set previewText property.
Parameters
propval | The string with which to preview the font. |
Get showPreviewEntry property.
Returns
Set showPreviewEntry property.
Parameters
propval | Whether to show an entry to change the preview text. |
Gets the currently-selected font name.
Note that this can be a different string than what you set with [gtk.font_chooser.FontChooser.setFont], 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.FontDescription.equal] if you want to compare two font descriptions.
Returns
of the current font, or null if no font is selected. You must free this string with [glib.global.gfree].
Gets the currently-selected font.
Note that this can be a different string than what you set with [gtk.font_chooser.FontChooser.setFont], 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.FontDescription.equal] if you want to compare two font descriptions.
Returns
current font, or null if no font is selected.
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
selected font group details, or null. The returned object is owned by fontchooser and must not be modified or freed.
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
selected font family, or null. The returned object is owned by fontchooser and must not be modified or freed.
Gets the currently-selected font features.
Returns
Gets the custom font map of this font chooser widget, or null if it does not have one.
Returns
The selected font size.
Returns
or -1 if no font size is selected.
Gets the language that is used for font features.
Returns
Returns the current level of granularity for selecting fonts.
Returns
Gets the text displayed in the preview area.
Returns
preview area
Returns whether the preview entry is shown or not.
Returns
or false if it is hidden.
Adds a filter function that decides which fonts to display in the font chooser.
Parameters
filter | a #GtkFontFilterFunc, or null |
Sets the currently-selected font.
Parameters
fontname | a font name like “Helvetica 12” or “Times Bold 18” |
Sets the currently-selected font from font_desc.
Parameters
fontDesc | a #PangoFontDescription |
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:
context = gtk_widget_get_pango_context (label);
pango_context_set_font_map (context, fontmap);Parameters
fontmap | a #PangoFontMap |
Sets the language to use for font features.
Parameters
language | a language |
Sets the desired level of granularity for selecting fonts.
Parameters
level | the desired level of granularity |
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 |
Shows or hides the editable preview entry.
Parameters
showPreviewEntry | whether to show the editable preview entry or not |
Connect to FontActivated signal.
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.
Parameters
callback | signal callback delegate or function to connect void callback(string fontname, gtk.font_chooser.FontChooser fontChooser) fontname the font name (optional) fontChooser the instance the signal is connected to (optional) |
after | Yes.After to execute callback after default handler, No.After to execute before (default) |
Returns
Set font property.
Parameters
propval | The font description as a string, e.g. "Sans Italic 12". |
Returns
Set fontDesc property.
Parameters
propval | The font description as a #PangoFontDescription. |
Returns
Set language property.
Parameters
propval | The language for which the #GtkFontChooser:font-features were selected, in a format that is compatible with CSS and with Pango attributes. |
Returns
Set level property.
Parameters
propval | The level of granularity to offer for selecting fonts. |
Returns
Set previewText property.
Parameters
propval | The string with which to preview the font. |
Returns
Set showPreviewEntry property.
Parameters
propval | Whether to show an entry to change the preview text. |