FontDialog#
Added in version 4.10.
Superclasses: Object
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 choose_font
function or its variants.
See FontDialogButton for a convenient control
that uses GtkFontDialog and presents the results.
Constructors#
- class FontDialog
- classmethod new() FontDialog#
Creates a new
GtkFontDialogobject.Added in version 4.10.
Methods#
- class FontDialog
- async choose_face(self, parent: Window | None = None, initial_value: FontFace | None = None) FontFace | None#
This is the awaitable version of
choose_face().Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the initial value
- choose_face(parent: Window | None = None, initial_value: FontFace | None = None, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
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).
Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the initial value
cancellable – a
GCancellableto cancel the operationcallback – a callback to call when the operation is complete
user_data – data to pass to
callback
- choose_face_finish(result: AsyncResult) FontFace | None#
Finishes the
choose_facecall and returns the resulting font face.Added in version 4.10.
- Parameters:
result – a
GAsyncResult
- async choose_family(self, parent: Window | None = None, initial_value: FontFamily | None = None) FontFamily | None#
This is the awaitable version of
choose_family().Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the initial value
- choose_family(parent: Window | None = None, initial_value: FontFamily | None = None, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
This function initiates a font selection operation by presenting a dialog to the user for selecting a font family.
Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the initial value
cancellable – a
GCancellableto cancel the operationcallback – a callback to call when the operation is complete
user_data – data to pass to
callback
- choose_family_finish(result: AsyncResult) FontFamily | None#
Finishes the
choose_familycall and returns the resulting family.This function never returns an error. If the operation is not finished successfully, the value passed as
initial_valuetochoose_familyis returned.Added in version 4.10.
- Parameters:
result – a
GAsyncResult
- async choose_font(self, parent: Window | None = None, initial_value: FontDescription | None = None) FontDescription | None#
This is the awaitable version of
choose_font().Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the font to select initially
- choose_font(parent: Window | None = None, initial_value: FontDescription | None = None, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
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
choose_font_and_featuresinstead.Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the font to select initially
cancellable – a
GCancellableto cancel the operationcallback – a callback to call when the operation is complete
user_data – data to pass to
callback
- async choose_font_and_features(self, parent: Window | None = None, initial_value: FontDescription | None = None) tuple[bool, FontDescription, str, Language]#
This is the awaitable version of
choose_font_and_features().Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the font to select initially
- choose_font_and_features(parent: Window | None = None, initial_value: FontDescription | None = None, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
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.
Added in version 4.10.
- Parameters:
parent – the parent
GtkWindowinitial_value – the font to select initially
cancellable – a
GCancellableto cancel the operationcallback – a callback to call when the operation is complete
user_data – data to pass to
callback
- choose_font_and_features_finish(result: AsyncResult) tuple[bool, FontDescription, str, Language]#
Finishes the
choose_font_and_featurescall and returns the resulting font description and font features.Added in version 4.10.
- Parameters:
result – a
GAsyncResult
- choose_font_finish(result: AsyncResult) FontDescription | None#
Finishes the
choose_fontcall and returns the resulting font description.Added in version 4.10.
- Parameters:
result – a
GAsyncResult
- get_filter() Filter | None#
Returns the filter that decides which fonts to display in the font chooser dialog.
Added in version 4.10.
- get_font_map() FontMap | None#
Returns the fontmap from which fonts are selected, or
NULLfor the default fontmap.Added in version 4.10.
- get_language() Language | None#
Returns the language for which font features are applied.
Added in version 4.10.
- get_modal() bool#
Returns whether the font chooser dialog blocks interaction with the parent window while it is presented.
Added in version 4.10.
- get_title() str#
Returns the title that will be shown on the font chooser dialog.
Added in version 4.10.
- set_filter(filter: Filter | None = None) None#
Adds a filter that decides which fonts to display in the font chooser dialog.
The
GtkFiltermust be able to handle bothPangoFontFamilyandPangoFontFaceobjects.Added in version 4.10.
- Parameters:
filter – a
GtkFilter
- set_font_map(fontmap: FontMap | None = None) None#
Sets the fontmap from which fonts are selected.
If
fontmapisNULL, the default fontmap is used.Added in version 4.10.
- Parameters:
fontmap – the fontmap
- set_language(language: Language) None#
Sets the language for which font features are applied.
Added in version 4.10.
- Parameters:
language – the language for font features
Properties#
- class FontDialog