Gtk.Font_Chooser.Gtk_Font_Chooser is an interface that can be implemented by widgets displaying the list of fonts. In GTK+, the main objects that implement this interface are Gtk.Font_Chooser_Widget.Gtk_Font_Chooser_Widget, Gtk.Font_Chooser_Dialog.Gtk_Font_Chooser_Dialog and Gtk.Font_Button.Gtk_Font_Button. The GtkFontChooser interface has been introducted in GTK+ 3.2.
function "+" (W : Gtk_Font_Chooser) return Gtk_Font_Chooser
type Cb_GObject_UTF8_String_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Fontname : UTF8_String);
type Cb_Gtk_Font_Chooser_UTF8_String_Void is not null access procedure
(Self : Gtk_Font_Chooser;
Fontname : UTF8_String);
subtype Font_Chooser_Interface_Descr is Glib.Object.Interface_Description;
Font_Chooser_Level_Family : constant Gtk_Font_Chooser_Level := 0;
Font_Chooser_Level_Features : constant Gtk_Font_Chooser_Level := 8;
Font_Chooser_Level_Size : constant Gtk_Font_Chooser_Level := 2;
Font_Chooser_Level_Style : constant Gtk_Font_Chooser_Level := 1;
Font_Chooser_Level_Variations : constant Gtk_Font_Chooser_Level := 4;
Font_Desc_Property : constant Pango.Font.Property_Font_Description;
Type: Pango.Font.Pango_Font_Description The font description as a Pango.Font.Pango_Font_Description.
Font_Features_Property : constant Glib.Properties.Property_String;
The selected font features, in a format that is compatible with CSS and with Pango attributes.
Font_Property : constant Glib.Properties.Property_String;
The font description as a string, e.g. "Sans Italic 12".
function Get_Font (Self : Gtk_Font_Chooser) return UTF8_String
Gets the currently-selected font name. Note that this can be a different string than what you set with Gtk.Font_Chooser.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 Pango.Font.Equal if you want to compare two font descriptions. Since: gtk+ 3.2
A string with the name of the current font, or null if no font is selected. You must free this string with g_free.
function Get_Font_Desc
(Self : Gtk_Font_Chooser) return Pango.Font.Pango_Font_Description
Gets the currently-selected font. Note that this can be a different string than what you set with Gtk.Font_Chooser.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 Pango.Font.Equal if you want to compare two font descriptions. Since: gtk+ 3.2
A Pango.Font.Pango_Font_Description for the current font, or null if no font is selected.
function Get_Font_Face
(Self : Gtk_Font_Chooser) return Pango.Font_Face.Pango_Font_Face
Gets the Pango.Font_Face.Pango_Font_Face representing the selected font group details (i.e. family, slant, weight, width, etc). If the selected font is not installed, returns null. Since: gtk+ 3.2
A Pango.Font_Face.Pango_Font_Face representing the selected font group details, or null. The returned object is owned by Fontchooser and must not be modified or freed.
function Get_Font_Family
(Self : Gtk_Font_Chooser) return Pango.Font_Family.Pango_Font_Family
Gets the Pango.Font_Family.Pango_Font_Family representing the selected font family. Font families are a collection of font faces. If the selected font is not installed, returns null. Since: gtk+ 3.2
A Pango.Font_Family.Pango_Font_Family representing the selected font family, or null. The returned object is owned by Fontchooser and must not be modified or freed.
function Get_Font_Features (Self : Gtk_Font_Chooser) return UTF8_String
Gets the currently-selected font features. Since: gtk+ 3.24
the currently selected font features
function Get_Font_Map
(Self : Gtk_Font_Chooser) return Pango.Font_Map.Pango_Font_Map
Gets the custom font map of this font chooser widget, or null if it does not have one. Since: gtk+ 3.18
a Pango.Font_Map.Pango_Font_Map, or null
function Get_Font_Size (Self : Gtk_Font_Chooser) return Glib.Gint
The selected font size. Since: gtk+ 3.2
A n integer representing the selected font size, or -1 if no font size is selected.
function Get_Language (Self : Gtk_Font_Chooser) return UTF8_String
Gets the language that is used for font features. Since: gtk+ 3.24
the currently selected language
function Get_Level
(Self : Gtk_Font_Chooser) return Gtk_Font_Chooser_Level
Returns the current level of granularity for selecting fonts. Since: gtk+ 3.24
the current granularity level
function Get_Preview_Text (Self : Gtk_Font_Chooser) return UTF8_String
Gets the text displayed in the preview area. Since: gtk+ 3.2
the text displayed in the preview area
function Get_Show_Preview_Entry (Self : Gtk_Font_Chooser) return Boolean
Returns whether the preview entry is shown or not. Since: gtk+ 3.2
True if the preview entry is shown or False if it is hidden.
function Get_Type return Glib.GType
type Gtk_Font_Chooser is new Glib.Types.GType_Interface;
type Gtk_Font_Chooser_Level is mod 2 ** Integer'Size;
This enumeration specifies the granularity of font selection that is desired in a font chooser.
This enumeration may be extended in the future; applications should ignore unknown values.
package Gtk_Font_Chooser_Level_Properties is
new Generic_Internal_Discrete_Property (Gtk_Font_Chooser_Level);
type Gtk_Font_Filter_Func is access function
(Family : not null access Pango.Font_Family.Pango_Font_Family_Record'Class;
Face : not null access Pango.Font_Face.Pango_Font_Face_Record'Class)
return Boolean;
The type of function that is used for deciding what fonts get shown in a Gtk.Font_Chooser.Gtk_Font_Chooser. See Gtk.Font_Chooser.Set_Filter_Func.
a Pango.Font_Family.Pango_Font_Family
a Pango.Font_Face.Pango_Font_Face belonging to Family
True if the font should be displayed
Language_Property : constant Glib.Properties.Property_String;
The language for which the Gtk.Font_Chooser.Gtk_Font_Chooser:font-features were selected, in a format that is compatible with CSS and with Pango attributes.
Level_Property : constant Gtk.Font_Chooser.Property_Gtk_Font_Chooser_Level;
Type: Gtk_Font_Chooser_Level The level of granularity to offer for selecting fonts.
Null_Gtk_Font_Chooser : constant Gtk_Font_Chooser;
procedure On_Font_Activated
(Self : Gtk_Font_Chooser;
Call : Cb_GObject_UTF8_String_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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.
procedure On_Font_Activated
(Self : Gtk_Font_Chooser;
Call : Cb_Gtk_Font_Chooser_UTF8_String_Void;
After : Boolean := False)
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.
Preview_Text_Property : constant Glib.Properties.Property_String;
The string with which to preview the font.
type Property_Gtk_Font_Chooser_Level is new Gtk_Font_Chooser_Level_Properties.Property;
procedure Set_Filter_Func
(Self : Gtk_Font_Chooser;
Filter : Gtk_Font_Filter_Func)
Adds a filter function that decides which fonts to display in the font chooser. Since: gtk+ 3.2
a Gtk_Font_Filter_Func, or null
procedure Set_Font (Self : Gtk_Font_Chooser; Fontname : UTF8_String)
Sets the currently-selected font. Since: gtk+ 3.2
a font name like "Helvetica 12" or "Times Bold 18"
procedure Set_Font_Activated
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Font_Activated)
procedure Set_Font_Desc
(Self : Gtk_Font_Chooser;
Font_Desc : Pango.Font.Pango_Font_Description)
Sets the currently-selected font from Font_Desc. Since: gtk+ 3.2
a Pango.Font.Pango_Font_Description
procedure Set_Font_Map
(Self : Gtk_Font_Chooser;
Fontmap : access Pango.Font_Map.Pango_Font_Map_Record'Class)
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.
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:
context = gtk_widget_get_pango_context (label);
pango_context_set_font_map (context, fontmap);
Since: gtk+ 3.18
a Pango.Font_Map.Pango_Font_Map
procedure Set_Get_Font_Face
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Get_Font_Face)
procedure Set_Get_Font_Family
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Get_Font_Family)
procedure Set_Get_Font_Map
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Get_Font_Map)
procedure Set_Get_Font_Size
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Get_Font_Size)
procedure Set_Language (Self : Gtk_Font_Chooser; Language : UTF8_String)
Sets the language to use for font features. Since: gtk+ 3.24
a language
procedure Set_Level
(Self : Gtk_Font_Chooser;
Level : Gtk_Font_Chooser_Level)
Sets the desired level of granularity for selecting fonts. Since: gtk+ 3.24
the desired level of granularity
procedure Set_Preview_Text (Self : Gtk_Font_Chooser; Text : UTF8_String)
Sets the text displayed in the preview area. The Text is used to show how the selected font looks. Since: gtk+ 3.2
the text to display in the preview area
procedure Set_Set_Filter_Func
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Set_Filter_Func)
procedure Set_Set_Font_Map
(Self : Font_Chooser_Interface_Descr;
Handler : Virtual_Set_Font_Map)
See Glib.Object.Add_Interface
procedure Set_Show_Preview_Entry
(Self : Gtk_Font_Chooser;
Show_Preview_Entry : Boolean)
Shows or hides the editable preview entry. Since: gtk+ 3.2
whether to show the editable preview entry or not
Show_Preview_Entry_Property : constant Glib.Properties.Property_Boolean;
Whether to show an entry to change the preview text.
Signal_Font_Activated : constant Glib.Signal_Name := "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.
type Virtual_Font_Activated is access procedure
(Self : Gtk_Font_Chooser;
Fontname : Gtkada.Types.Chars_Ptr);
type Virtual_Get_Font_Face is access function (Self : Gtk_Font_Chooser) return System.Address;
Gets the Pango.Font_Face.Pango_Font_Face representing the selected font group details (i.e. family, slant, weight, width, etc). If the selected font is not installed, returns null. Since: gtk+ 3.2
A Pango.Font_Face.Pango_Font_Face representing the selected font group details, or null. The returned object is owned by Fontchooser and must not be modified or freed.
type Virtual_Get_Font_Family is access function (Self : Gtk_Font_Chooser) return System.Address;
Gets the Pango.Font_Family.Pango_Font_Family representing the selected font family. Font families are a collection of font faces. If the selected font is not installed, returns null. Since: gtk+ 3.2
A Pango.Font_Family.Pango_Font_Family representing the selected font family, or null. The returned object is owned by Fontchooser and must not be modified or freed.
type Virtual_Get_Font_Map is access function (Self : Gtk_Font_Chooser) return System.Address;
Gets the custom font map of this font chooser widget, or null if it does not have one. Since: gtk+ 3.18
a Pango.Font_Map.Pango_Font_Map, or null
type Virtual_Get_Font_Size is access function (Self : Gtk_Font_Chooser) return Glib.Gint;
The selected font size. Since: gtk+ 3.2
A n integer representing the selected font size, or -1 if no font size is selected.
type Virtual_Set_Filter_Func is access procedure
(Self : Gtk_Font_Chooser;
Filter : System.Address;
User_Data : System.Address;
Destroy : Glib.G_Destroy_Notify_Address);
Adds a filter function that decides which fonts to display in the font chooser. Since: gtk+ 3.2
a Gtk_Font_Filter_Func, or null
data to pass to Filter
function to call to free Data when it is no longer needed
type Virtual_Set_Font_Map is access procedure (Self : Gtk_Font_Chooser; Fontmap : System.Address);
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.
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:
context = gtk_widget_get_pango_context (label);
pango_context_set_font_map (context, fontmap);
Since: gtk+ 3.18
a Pango.Font_Map.Pango_Font_Map