About all my projects
Gnome::Gtk4::R-FontChooser

Gnome::Gtk4::R-FontChooser

Description

Gnome::Gtk4::R-FontChooser is an interface that can be implemented by widgets for choosing fonts.

In GTK, the main objects that implement this interface are Gnome::Gtk4::FontChooserWidget, Gnome::Gtk4::FontChooserDialog and Gnome::Gtk4::FontButton.

Methods

get-font

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the currently-selected font name.

Note that this can be a different string than what you set with .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 .equal() in class Gnome::Pango::N-FontDescription if you want to compare two font descriptions.

method get-font (--> Str )

Return value; A string with the name of the current font.

get-font-desc

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the currently-selected font.

Note that this can be a different string than what you set with .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 .equal() in class Gnome::Pango::N-FontDescription if you want to compare two font descriptions.

method get-font-desc (--> N-Object )

Return value; A Gnome::Pango::N-FontDescription for the current font.

get-font-face

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the Gnome::Pango::FontFace representing the selected font group details (i.e. family, slant, weight, width, etc).

If the selected font is not installed, returns undefined.

method get-font-face (--> N-Object )

Return value; A Gnome::Pango::FontFace representing the selected font group details.

get-font-family

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the Gnome::Pango::FontFamily representing the selected font family.

Font families are a collection of font faces.

If the selected font is not installed, returns undefined.

method get-font-family (--> N-Object )

Return value; A Gnome::Pango::FontFamily representing the selected font family.

get-font-features

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the currently-selected font features.

The format of the returned string is compatible with the [CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc). It can be passed to .AttrFontFeatures.new() in package Gnome::Pango.

method get-font-features (--> Str )

Return value; the currently selected font features.

get-font-map

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the custom font map of this font chooser widget, or undefined if it does not have one.

method get-font-map (--> N-Object )

Return value; a Gnome::Pango::FontMap.

get-font-size

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

The selected font size.

method get-font-size (--> Int )

Return value; A n integer representing the selected font size, or -1 if no font size is selected..

get-language

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the language that is used for font features.

method get-language (--> Str )

Return value; the currently selected language.

get-level

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the current level of granularity for selecting fonts.

method get-level (--> UInt )

Return value; the current granularity level.

get-preview-text

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the text displayed in the preview area.

method get-preview-text (--> Str )

Return value; the text displayed in the preview area.

get-show-preview-entry

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns whether the preview entry is shown or not.

method get-show-preview-entry (--> Bool )

Return value; True if the preview entry is shown or False if it is hidden..

set-filter-func This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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

method set-filter-func ( &filter, gpointer $user-data, … )
  • &filter; a Gnome::Gtk4::T-fontchooser. Tthe function must be specified with following signature; :( N-Object $family, N-Object $face, gpointer $data -- gboolean )>.

  • $user-data; data to pass to $filter.

  • destroy; function to call to free $data when it is no longer needed. Note that each argument must be specified as a type followed by its value!

set-font

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the currently-selected font.

method set-font ( Str $fontname )
  • $fontname; a font name like “Helvetica 12” or “Times Bold 18”.

set-font-desc

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the currently-selected font from $font-desc.

method set-font-desc ( N-Object $font-desc )
  • $font-desc; a Gnome::Pango::N-FontDescription

set-font-map

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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.

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:

method set-font-map ( N-Object() $fontmap )
  • $fontmap; a Gnome::Pango::FontMap.

set-language

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the language to use for font features.

method set-language ( Str $language )
  • $language; a language.

set-level

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the desired level of granularity for selecting fonts.

method set-level ( UInt $level )
  • $level; the desired level of granularity.

set-preview-text

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the text displayed in the preview area.

The $text is used to show how the selected font looks.

method set-preview-text ( Str $text )
  • $text; the text to display in the preview area.

set-show-preview-entry

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Shows or hides the editable preview entry.

method set-show-preview-entry ( Bool() $show-preview-entry )
  • $show-preview-entry; whether to show the editable preview entry or not.

Signals

font-activated

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.

method handler (
  Str $fontname,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::FontChooser :$_widget,
  *C<user>-options
)
  • $fontname; the font name.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::FontChooser object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.