Basics
Guides
API Reference
Basics
Guides
API Reference
[16:7] extends: object
GtkFontChooser is an interface that can be implemented by widgets for
choosing fonts. In GTK, the main objects that implement this interface are
[class@Gtk.FontChooserWidget], [class@Gtk.FontChooserDialog] and
[class@Gtk.FontButton].
FontChooser (Handle = null)
Creates a new
FontChooserby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnFontactivated (callback Fn, UserData = null)
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.
Fn is the Aussom callback.Fn is called with (FontChooser Self, string Fontname).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setFont (string Value)
The font description as a string, e.g. "Sans Italic 12".
Value is the new property value.None.setFontdesc (object Value)
The font description as a
PangoFontDescription.
Value is the new property value.None.setLanguage (string Value)
The language for which the font features were selected.
Value is the new property value.None.setLevel (string Value)
The level of granularity to offer for selecting fonts.
Value is the new property value.None.setPreviewtext (string Value)
The string with which to preview the font.
Value is the new property value.None.setShowpreviewentry (bool Value)
Whether to show an entry to change the preview text.
Value is the new property value.None.get_font ()
Gets the currently-selected font name. Note that this can be a different string than what you set with [method@Gtk.FontChooser.set_font], 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 [method@Pango.FontDescription.equal] if you want to compare two font descriptions.
get_font_desc ()
Gets the currently-selected font. Note that this can be a different string than what you set with [method@Gtk.FontChooser.set_font], 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 [method@Pango.FontDescription.equal] if you want to compare two font descriptions.
get_font_face ()
Gets the
PangoFontFacerepresenting the selected font group details (i.e. family, slant, weight, width, etc). If the selected font is not installed, returns %NULL.
get_font_family ()
Gets the
PangoFontFamilyrepresenting the selected font family. Font families are a collection of font faces. If the selected font is not installed, returns %NULL.
get_font_features ()
Gets the currently-selected font features. The format of the returned string is compatible with the CSS font-feature-settings property. It can be passed to [func@Pango.AttrFontFeatures.new].
get_font_map ()
Gets the custom font map of this font chooser widget, or %NULL if it does not have one.
get_font_size ()
The selected font size.
get_language ()
Gets the language that is used for font features.
get_level ()
Returns the current level of granularity for selecting fonts.
get_preview_text ()
Gets the text displayed in the preview area.
get_show_preview_entry ()
Returns whether the preview entry is shown or not.
set_font (string fontname)
Sets the currently-selected font.
fontname is a font name like “Helvetica 12” or “Times Bold 18”.None.set_font_desc (object font_desc)
Sets the currently-selected font from @font_desc.
font_desc is a PangoFontDescription.None.set_font_map (object fontmap)
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.
c 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:c context = gtk_widget_get_pango_context (label); pango_context_set_font_map (context, fontmap);
fontmap is a PangoFontMap.None.set_language (string language)
Sets the language to use for font features.
language is a language.None.set_level (string level)
Sets the desired level of granularity for selecting fonts.
level is the desired level of granularity.None.set_preview_text (string text)
Sets the text displayed in the preview area. The @text is used to show how the selected font looks.
text is the text to display in the preview area.None.set_show_preview_entry (bool show_preview_entry)
Shows or hides the editable preview entry.
show_preview_entry is whether to show the editable preview entry or not.None.[454:7] extends: object
Generated low-level callback wrapper for GIR callback font-activated.
FontChooserFontactivatedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, fontname, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[524:14] static extends: object
Generated metadata helpers for FontChooser interface surfaces.
properties ()
Returns property metadata for
FontChooser.
A list.signals ()
Returns signal metadata for
FontChooser.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.