Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: FontChooser

[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].

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • FontChooser (Handle = null)

    Creates a new FontChooser by wrapping a native handle or another wrapper.

    • @p 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 exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r 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.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (FontChooser Self, string Fontname).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r 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".

    • @p Value is the new property value.
    • @r None.
  • setFontdesc (object Value)

    The font description as a PangoFontDescription.

    • @p Value is the new property value.
    • @r None.
  • setLanguage (string Value)

    The language for which the font features were selected.

    • @p Value is the new property value.
    • @r None.
  • setLevel (string Value)

    The level of granularity to offer for selecting fonts.

    • @p Value is the new property value.
    • @r None.
  • setPreviewtext (string Value)

    The string with which to preview the font.

    • @p Value is the new property value.
    • @r None.
  • setShowpreviewentry (bool Value)

    Whether to show an entry to change the preview text.

    • @p Value is the new property value.
    • @r 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 PangoFontFace representing 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 PangoFontFamily representing 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.

    • @p fontname is a font name like “Helvetica 12” or “Times Bold 18”.
    • @r None.
  • set_font_desc (object font_desc)

    Sets the currently-selected font from @font_desc.

    • @p font_desc is a PangoFontDescription.
    • @r 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);

    • @p fontmap is a PangoFontMap.
    • @r None.
  • set_language (string language)

    Sets the language to use for font features.

    • @p language is a language.
    • @r None.
  • set_level (string level)

    Sets the desired level of granularity for selecting fonts.

    • @p level is the desired level of granularity.
    • @r 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.

    • @p text is the text to display in the preview area.
    • @r None.
  • set_show_preview_entry (bool show_preview_entry)

    Shows or hides the editable preview entry.

    • @p show_preview_entry is whether to show the editable preview entry or not.
    • @r None.

class: FontChooserFontactivatedCallback

[454:7] extends: object

Generated low-level callback wrapper for GIR callback font-activated.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • 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.

    • @p Fn is the Aussom callback implementation.
    • @p 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.

class: FontChooserMeta

[524:14] static extends: object

Generated metadata helpers for FontChooser interface surfaces.

Methods

  • properties ()

    Returns property metadata for FontChooser.

    • @r A list.
  • signals ()

    Returns signal metadata for FontChooser.

    • @r A list.