Gtk.FontDialog

g GObject.Object GObject.Object Gtk.FontDialog Gtk.FontDialog GObject.Object->Gtk.FontDialog

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

choose_face (parent, initial_value, cancellable, callback, *user_data)

choose_face_finish (result)

choose_family (parent, initial_value, cancellable, callback, *user_data)

choose_family_finish (result)

choose_font (parent, initial_value, cancellable, callback, *user_data)

choose_font_and_features (parent, initial_value, cancellable, callback, *user_data)

choose_font_and_features_finish (result)

choose_font_finish (result)

get_filter ()

get_font_map ()

get_language ()

get_modal ()

get_title ()

set_filter (filter)

set_font_map (fontmap)

set_language (language)

set_modal (modal)

set_title (title)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

filter

Gtk.Filter

r/w/en

font-map

Pango.FontMap

r/w/en

language

Pango.Language

r/w/en

modal

bool

r/w/en

title

str

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.FontDialog(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gtk.FontDialogClass

A GtkFontDialog object collects the arguments that are needed to present a font chooser dialog to the user, such as a title for the dialog and whether it should be modal.

The dialog is shown with the [method`Gtk`.FontDialog.choose_font] function or its variants.

See [class`Gtk`.FontDialogButton] for a convenient control that uses GtkFontDialog and presents the results.

New in version 4.10.

classmethod new()[source]
Returns:

the new GtkFontDialog

Return type:

Gtk.FontDialog

Creates a new GtkFontDialog object.

New in version 4.10.

choose_face(parent, initial_value, cancellable, callback, *user_data)[source]
Parameters:

This function initiates a font selection operation by presenting a dialog to the user for selecting a font face (i.e. a font family and style, but not a specific font size).

New in version 4.10.

choose_face_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – a GAsyncResult

Raises:

GLib.Error

Returns:

the selected font face

Return type:

Pango.FontFace or None

Finishes the [method`Gtk`.FontDialog.choose_face] call and returns the resulting font face.

New in version 4.10.

choose_family(parent, initial_value, cancellable, callback, *user_data)[source]
Parameters:

This function initiates a font selection operation by presenting a dialog to the user for selecting a font family.

New in version 4.10.

choose_family_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – a GAsyncResult

Raises:

GLib.Error

Returns:

the selected family

Return type:

Pango.FontFamily or None

Finishes the [method`Gtk`.FontDialog.choose_family] call and returns the resulting family.

This function never returns an error. If the operation is not finished successfully, the value passed as initial_value to [method`Gtk`.FontDialog.choose_family] is returned.

New in version 4.10.

choose_font(parent, initial_value, cancellable, callback, *user_data)[source]
Parameters:

This function initiates a font selection operation by presenting a dialog to the user for selecting a font.

If you want to let the user select font features as well, use [method`Gtk`.FontDialog.choose_font_and_features] instead.

New in version 4.10.

choose_font_and_features(parent, initial_value, cancellable, callback, *user_data)[source]
Parameters:

This function initiates a font selection operation by presenting a dialog to the user for selecting a font and font features.

Font features affect how the font is rendered, for example enabling glyph variants or ligatures.

New in version 4.10.

choose_font_and_features_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – a GAsyncResult

Raises:

GLib.Error

Returns:

TRUE if a font was selected. Otherwise FALSE is returned and error is set

font_desc:

return location for font description

font_features:

return location for font features

language:

return location for the language

Return type:

(bool, font_desc: Pango.FontDescription, font_features: str, language: Pango.Language)

Finishes the [method`Gtk`.FontDialog.choose_font_and_features] call and returns the resulting font description and font features.

New in version 4.10.

choose_font_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – a GAsyncResult

Raises:

GLib.Error

Returns:

the selected font

Return type:

Pango.FontDescription or None

Finishes the [method`Gtk`.FontDialog.choose_font] call and returns the resulting font description.

New in version 4.10.

get_filter()[source]
Returns:

the filter

Return type:

Gtk.Filter or None

Returns the filter that decides which fonts to display in the font chooser dialog.

New in version 4.10.

get_font_map()[source]
Returns:

the fontmap

Return type:

Pango.FontMap or None

Returns the fontmap from which fonts are selected, or NULL for the default fontmap.

New in version 4.10.

get_language()[source]
Returns:

the language for font features

Return type:

Pango.Language or None

Returns the language for which font features are applied.

New in version 4.10.

get_modal()[source]
Returns:

TRUE if the font chooser dialog is modal

Return type:

bool

Returns whether the font chooser dialog blocks interaction with the parent window while it is presented.

New in version 4.10.

get_title()[source]
Returns:

the title

Return type:

str

Returns the title that will be shown on the font chooser dialog.

New in version 4.10.

set_filter(filter)[source]
Parameters:

filter (Gtk.Filter or None) – a GtkFilter

Adds a filter that decides which fonts to display in the font chooser dialog.

The GtkFilter must be able to handle both PangoFontFamily and PangoFontFace objects.

New in version 4.10.

set_font_map(fontmap)[source]
Parameters:

fontmap (Pango.FontMap or None) – the fontmap

Sets the fontmap from which fonts are selected.

If fontmap is NULL, the default fontmap is used.

New in version 4.10.

set_language(language)[source]
Parameters:

language (Pango.Language) – the language for font features

Sets the language for which font features are applied.

New in version 4.10.

set_modal(modal)[source]
Parameters:

modal (bool) – the new value

Sets whether the font chooser dialog blocks interaction with the parent window while it is presented.

New in version 4.10.

set_title(title)[source]
Parameters:

title (str) – the new title

Sets the title that will be shown on the font chooser dialog.

New in version 4.10.

Property Details

Gtk.FontDialog.props.filter
Name:

filter

Type:

Gtk.Filter

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Sets a filter to restrict what fonts are shown in the font chooser dialog.

New in version 4.10.

Gtk.FontDialog.props.font_map
Name:

font-map

Type:

Pango.FontMap

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Sets a custom font map to select fonts from.

A custom font map can be used to present application-specific fonts instead of or in addition to the normal system fonts.

New in version 4.10.

Gtk.FontDialog.props.language
Name:

language

Type:

Pango.Language

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The language for which the font features are selected.

New in version 4.10.

Gtk.FontDialog.props.modal
Name:

modal

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the font chooser dialog is modal.

New in version 4.10.

Gtk.FontDialog.props.title
Name:

title

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A title that may be shown on the font chooser dialog that is presented by [method`Gtk`.FontDialog.choose_font].

New in version 4.10.