Gtk.FontDialog¶
class — extends GObject.Object
Asynchronous API to present a font chooser dialog.
GtkFontDialog collects the arguments that are needed to present
the dialog to the user, such as a title for the dialog and whether
it should be modal.
The dialog is shown with the FontDialog.choose_font
function or its variants.
See FontDialogButton for a convenient control
that uses GtkFontDialog and presents the results.
Constructors¶
new¶
Creates a new GtkFontDialog object.
Methods¶
choose_face¶
def choose_face(self, parent: Window | None = ..., initial_value: Pango.FontFace | None = ..., cancellable: Gio.Cancellable | None = ..., callback: Gio.AsyncReadyCallback | None = ...) -> None
Presents a font chooser dialog to the user.
The font chooser dialog will be set up for selecting a font face.
A font face represents a font family and style, but no specific font size.
Parameters:
parent— the parent windowinitial_value— the initial valuecancellable— a cancellable to cancel the operationcallback— a callback to call when the operation is complete
choose_face_finish¶
Finishes the FontDialog.choose_face call.
Note that this function returns a DialogError.DISMISSED
error if the user cancels the dialog.
Parameters:
result— the result
choose_family¶
def choose_family(self, parent: Window | None = ..., initial_value: Pango.FontFamily | None = ..., cancellable: Gio.Cancellable | None = ..., callback: Gio.AsyncReadyCallback | None = ...) -> None
Presents a font chooser dialog to the user.
The font chooser dialog will be set up for selecting a font family.
Parameters:
parent— the parent windowinitial_value— the initial valuecancellable— a cancellable to cancel the operationcallback— a callback to call when the operation is complete
choose_family_finish¶
Finishes the FontDialog.choose_family call.
Note that this function returns a DialogError.DISMISSED
error if the user cancels the dialog.
Parameters:
result— the result
choose_font¶
def choose_font(self, parent: Window | None = ..., initial_value: Pango.FontDescription | None = ..., cancellable: Gio.Cancellable | None = ..., callback: Gio.AsyncReadyCallback | None = ...) -> None
Presents a font chooser dialog to the user.
The font chooser dialog will be set up for selecting a font.
If you want to let the user select font features as well,
use FontDialog.choose_font_and_features instead.
Parameters:
parent— the parent windowinitial_value— the font to select initiallycancellable— a cancellable to cancel the operationcallback— a callback to call when the operation is complete
choose_font_and_features¶
def choose_font_and_features(self, parent: Window | None = ..., initial_value: Pango.FontDescription | None = ..., cancellable: Gio.Cancellable | None = ..., callback: Gio.AsyncReadyCallback | None = ...) -> None
Presents a font chooser dialog to the user.
The font chooser dialog will be set up for selecting a font and specify features for the selected font.
Font features affect how the font is rendered, for example enabling glyph variants or ligatures.
Parameters:
parent— the parent windowinitial_value— the font to select initiallycancellable— a cancellable to cancel the operationcallback— a callback to call when the operation is complete
choose_font_and_features_finish¶
def choose_font_and_features_finish(self, result: Gio.AsyncResult) -> tuple[bool, Pango.FontDescription, str, Pango.Language]
Finishes the FontDialog.choose_font_and_features call.
The selected font and features are returned in font_desc and
font_features.
Note that this function returns a DialogError.DISMISSED
error if the user cancels the dialog.
Parameters:
result— the result
choose_font_finish¶
Finishes the FontDialog.choose_font call.
Note that this function returns a DialogError.DISMISSED
error if the user cancels the dialog.
Parameters:
result— the result
get_filter¶
Returns the filter that decides which fonts to display in the font chooser dialog.
get_font_map¶
Returns the fontmap from which fonts are selected,
or NULL for the default fontmap.
get_language¶
Returns the language for which font features are applied.
get_modal¶
Returns whether the font chooser dialog blocks interaction with the parent window while it is presented.
get_title¶
Returns the title that will be shown on the font chooser dialog.
set_filter¶
Adds a filter that decides which fonts to display in the font chooser dialog.
The filter must be able to handle both PangoFontFamily
and PangoFontFace objects.
Parameters:
filter— the filter
set_font_map¶
Sets the fontmap from which fonts are selected.
If fontmap is NULL, the default fontmap is used.
Parameters:
fontmap— the fontmap
set_language¶
Sets the language for which font features are applied.
Parameters:
language— the language for font features
set_modal¶
Sets whether the font chooser dialog blocks interaction with the parent window while it is presented.
Parameters:
modal— the new value
set_title¶
Sets the title that will be shown on the font chooser dialog.
Parameters:
title— the new title
Properties¶
filter¶
A filter to restrict what fonts are shown in the font chooser dialog.
font_map¶
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.
language¶
The language for which the font features are selected.
modal¶
Whether the font chooser dialog is modal.
title¶
A title that may be shown on the font chooser
dialog that is presented by FontDialog.choose_font.