Gtk.FontChooser


Gtk.FontChooser — Interface implemented by widgets displaying fonts

Object Hierarchy:

    GInterface
    ╰── Gtk.FontChooser

See also:

Gtk.FontChooserDialog, Gtk.FontChooserWidget, Gtk.FontButton


Functions:

Description:

Gtk.FontChooser is an interface that can be implemented by widgets displaying the list of fonts.

In GTK+, the main objects that implement this interface are Gtk.FontChooserWidget, Gtk.FontChooserDialog and Gtk.FontButton.

The Gtk.FontChooser interface has been introducted in GTK+ 3.2.


Function Details:

get_font_family()

get_font_family (self) -> Pango.FontFamily

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.

  • Returns: A PangoFontFamily representing theselected font family, or None. The returned object is owned by fontchooserand must not be modified or freed.

  • Since: 3.2


get_font_face()

get_font_face (self) -> Pango.FontFace

Gets the PangoFontFace representing the selected font groupdetails (i.e. family, slant, weight, width, etc). If the selected font is not installed, returns None.

  • Returns: A PangoFontFace representing theselected font group details, or None. The returned object is owned byfontchooserand must not be modified or freed.

  • Since: 3.2


get_font_size()

get_font_size (self) -> int

The selected font size.

  • Returns: A n integer representing the selected font size,or -1 if no font size is selected.

  • Since: 3.2


get_font()

get_font (self) -> str

Gets the currently-selected font name. Note that this can be a different string than what you set withGtk.FontChooser:set_font(), as the font chooser widget maynormalize font names and thus return a string with a differentstructure. For example, “Helvetica Italic Bold 12” could benormalized to “Helvetica Bold Italic 12”. Use pango_font_description_equal() if you want to compare twofont descriptions.

  • Returns: A string with the nameof the current font, or None if no font is selected. You mustfree this string with g_free().

  • Since: 3.2


set_font()

set_font (self, fontname:str)

Sets the currently-selected font.

  • Since: 3.2

get_font_desc()

get_font_desc (self) -> Pango.FontDescription

Gets the currently-selected font. Note that this can be a different string than what you set withGtk.FontChooser:set_font(), as the font chooser widget maynormalize font names and thus return a string with a differentstructure. For example, “Helvetica Italic Bold 12” could benormalized to “Helvetica Bold Italic 12”. Use pango_font_description_equal() if you want to compare twofont descriptions.

  • Returns: A PangoFontDescription for thecurrent font, or None if no font is selected.

  • Since: 3.2


set_font_desc()

set_font_desc (self, font_desc:Pango.FontDescription)

Sets the currently-selected font from font_desc.

  • Since: 3.2

get_preview_text()

get_preview_text (self) -> str

Gets the text displayed in the preview area.

  • Returns: the text displayed in thepreview area.

  • Since: 3.2


set_preview_text()

set_preview_text (self, text:str)

Sets the text displayed in the preview area.The text is used to show how the selected font looks.

  • Since: 3.2

get_show_preview_entry()

get_show_preview_entry (self) -> bool

Returns whether the preview entry is shown or not.

  • Returns: True if the preview entry is shownor FALSE if it is hidden.

  • Since: 3.2


set_show_preview_entry()

set_show_preview_entry (self, show_preview_entry:bool)

Shows or hides the editable preview entry.

  • Since: 3.2

set_filter_func()

set_filter_func (self, filter:Gtk.FontFilterFunc=None, user_data=None)

Adds a filter function that decides which fonts to displayin the font chooser.

  • Since: 3.2

set_font_map()

set_font_map (self, fontmap:Pango.FontMap=None)

Sets a custom font map to use for this font chooser widget.A custom font map can be used to present application-specificfonts 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.FontChooser:set_font_map (font_chooser, fontmap); Note that other GTK+ widgets will only be able to use the application-specificfont if it is present in the font map they use: context = Gtk.Widget:get_pango_context (label);pango_context_set_font_map (context, fontmap);

  • Since: 3.18

get_font_map()

get_font_map (self) -> Pango.FontMap

Gets the custom font map of this font chooser widget,or None if it does not have one.

  • Returns: a PangoFontMap, or None.

  • Since: 3.18


results matching ""

    No results matching ""