Module: Gtk::FontChooser
- Defined in:
- (unknown)
Overview
Gtk::FontChooser 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::FontChooserWidget, Gtk::FontChooserDialog and #GtkFontButton. The GtkFontChooser interface has been introducted in GTK+ 3.2.
Instance Method Summary collapse
-
#font ⇒ String
Gets the currently-selected font name.
-
#font=(fontname) ⇒ nil
Sets the currently-selected font.
- #font_activated(chooser, fontname) ⇒ nil
-
#font_desc ⇒ Pango::FontDescription
Gets the currently-selected font.
-
#font_desc=(font_desc) ⇒ nil
Sets the currently-selected font from font_desc.
-
#font_face ⇒ Pango::FontFace
Gets the Pango::FontFace representing the selected font group details (i.e. family, slant, weight, width, etc).
-
#font_family ⇒ Pango::FontFamily
Gets the Pango::FontFamily representing the selected font family.
-
#font_features ⇒ String
Gets the currently-selected font features.
-
#font_map ⇒ Pango::FontMap
Gets the custom font map of this font chooser widget, or nil if it does not have one.
-
#font_map=(fontmap) ⇒ nil
Sets a custom font map to use for this font chooser widget.
-
#font_size ⇒ Integer
The selected font size.
-
#get_font_face(fontchooser) ⇒ Pango::FontFace
A Pango::FontFace representing the selected font group details, or nil.
-
#get_font_family(fontchooser) ⇒ Pango::FontFamily
A Pango::FontFamily representing the selected font family, or nil.
-
#get_font_map(fontchooser) ⇒ Pango::FontMap
A Pango::FontMap, or nil.
-
#get_font_size(fontchooser) ⇒ Integer
A n integer representing the selected font size, or -1 if no font size is selected.
-
#language ⇒ String
Gets the language that is used for font features.
-
#language=(language) ⇒ nil
Sets the language to use for font features.
-
#level ⇒ Gtk::FontChooserLevel
Returns the current level of granularity for selecting fonts.
-
#level=(level) ⇒ nil
Sets the desired level of granularity for selecting fonts.
-
#preview_text ⇒ String
Gets the text displayed in the preview area.
-
#preview_text=(text) ⇒ nil
Sets the text displayed in the preview area.
- #set_filter_func(fontchooser, filter, user_data, destroy) ⇒ nil
- #set_font_map(fontchooser, fontmap) ⇒ nil
-
#show_preview_entry ⇒ TrueClass
Returns whether the preview entry is shown or not.
-
#show_preview_entry=(show_preview_entry) ⇒ nil
Shows or hides the editable preview entry.
Instance Method Details
#font ⇒ 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_description_equal() if you want to compare two font descriptions.
#font=(fontname) ⇒ nil
Sets the currently-selected font.
#font_activated(chooser, fontname) ⇒ nil
#font_desc ⇒ Pango::FontDescription
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_description_equal() if you want to compare two font descriptions.
#font_desc=(font_desc) ⇒ nil
Sets the currently-selected font from font_desc.
#font_face ⇒ Pango::FontFace
Gets the Pango::FontFace representing the selected font group details (i.e. family, slant, weight, width, etc).
If the selected font is not installed, returns nil.
#font_family ⇒ Pango::FontFamily
Gets the Pango::FontFamily representing the selected font family. Font families are a collection of font faces.
If the selected font is not installed, returns nil.
#font_features ⇒ String
Gets the currently-selected font features.
#font_map ⇒ Pango::FontMap
Gets the custom font map of this font chooser widget, or nil if it does not have one.
#font_map=(fontmap) ⇒ nil
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);
#font_size ⇒ Integer
The selected font size.
#get_font_face(fontchooser) ⇒ Pango::FontFace
Returns A Pango::FontFace representing the selected font group details, or nil. The returned object is owned by fontchooser and must not be modified or freed.
#get_font_family(fontchooser) ⇒ Pango::FontFamily
Returns A Pango::FontFamily representing the selected font family, or nil. The returned object is owned by fontchooser and must not be modified or freed.
#get_font_map(fontchooser) ⇒ Pango::FontMap
Returns a Pango::FontMap, or nil.
#get_font_size(fontchooser) ⇒ Integer
Returns A n integer representing the selected font size, or -1 if no font size is selected.
#language ⇒ String
Gets the language that is used for font features.
#language=(language) ⇒ nil
Sets the language to use for font features.
#level ⇒ Gtk::FontChooserLevel
Returns the current level of granularity for selecting fonts.
#level=(level) ⇒ nil
Sets the desired level of granularity for selecting fonts.
#preview_text ⇒ String
Gets the text displayed in the preview area.
#preview_text=(text) ⇒ nil
Sets the text displayed in the preview area. The text is used to show how the selected font looks.
#set_filter_func(fontchooser, filter, user_data, destroy) ⇒ nil
#set_font_map(fontchooser, fontmap) ⇒ nil
#show_preview_entry ⇒ TrueClass
Returns whether the preview entry is shown or not.
#show_preview_entry=(show_preview_entry) ⇒ nil
Shows or hides the editable preview entry.