pub trait FontChooserExt: IsA<FontChooser> + 'static {
Show 27 methods
// Provided methods
fn font(&self) -> Option<GString> { ... }
fn font_desc(&self) -> Option<FontDescription> { ... }
fn font_face(&self) -> Option<FontFace> { ... }
fn font_family(&self) -> Option<FontFamily> { ... }
fn font_features(&self) -> Option<GString> { ... }
fn font_map(&self) -> Option<FontMap> { ... }
fn font_size(&self) -> i32 { ... }
fn language(&self) -> Option<GString> { ... }
fn level(&self) -> FontChooserLevel { ... }
fn preview_text(&self) -> Option<GString> { ... }
fn shows_preview_entry(&self) -> bool { ... }
fn set_filter_func(
&self,
filter: Option<Box_<dyn Fn(&FontFamily, &FontFace) -> bool + 'static>>,
) { ... }
fn set_font(&self, fontname: &str) { ... }
fn set_font_desc(&self, font_desc: &FontDescription) { ... }
fn set_font_map(&self, fontmap: Option<&impl IsA<FontMap>>) { ... }
fn set_language(&self, language: &str) { ... }
fn set_level(&self, level: FontChooserLevel) { ... }
fn set_preview_text(&self, text: &str) { ... }
fn set_show_preview_entry(&self, show_preview_entry: bool) { ... }
fn connect_font_activated<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_font_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_font_desc_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_font_features_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_language_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_level_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_preview_text_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}Expand description
Trait containing all FontChooser methods.
§Implementors
FontButton, FontChooserDialog, FontChooserWidget, FontChooser
Provided Methods§
Sourcefn font(&self) -> Option<GString>
fn font(&self) -> Option<GString>
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 pango_font_description_equal() if you want to compare two
font descriptions.
§Returns
A string with the name
of the current font, or None if no font is selected. You must
free this string with g_free().
Sourcefn font_desc(&self) -> Option<FontDescription>
fn font_desc(&self) -> Option<FontDescription>
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 pango_font_description_equal() if you want to compare two
font descriptions.
§Returns
A pango::FontDescription for the
current font, or None if no font is selected.
Sourcefn font_face(&self) -> Option<FontFace>
fn font_face(&self) -> Option<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 None.
§Returns
A pango::FontFace representing the
selected font group details, or None. The returned object is owned by
self and must not be modified or freed.
Sourcefn font_family(&self) -> Option<FontFamily>
fn font_family(&self) -> Option<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 None.
§Returns
A pango::FontFamily representing the
selected font family, or None. The returned object is owned by self
and must not be modified or freed.
Sourcefn font_features(&self) -> Option<GString>
Available on crate feature v3_24 only.
fn font_features(&self) -> Option<GString>
v3_24 only.Sourcefn font_map(&self) -> Option<FontMap>
fn font_map(&self) -> Option<FontMap>
Gets the custom font map of this font chooser widget,
or None if it does not have one.
§Returns
a pango::FontMap, or None
Sourcefn font_size(&self) -> i32
fn font_size(&self) -> i32
The selected font size.
§Returns
A n integer representing the selected font size, or -1 if no font size is selected.
Sourcefn level(&self) -> FontChooserLevel
Available on crate feature v3_24 only.
fn level(&self) -> FontChooserLevel
v3_24 only.Returns the current level of granularity for selecting fonts.
§Returns
the current granularity level
Sourcefn preview_text(&self) -> Option<GString>
fn preview_text(&self) -> Option<GString>
Sourcefn shows_preview_entry(&self) -> bool
fn shows_preview_entry(&self) -> bool
Sourcefn set_filter_func(
&self,
filter: Option<Box_<dyn Fn(&FontFamily, &FontFace) -> bool + 'static>>,
)
fn set_filter_func( &self, filter: Option<Box_<dyn Fn(&FontFamily, &FontFace) -> bool + 'static>>, )
Sourcefn set_font_desc(&self, font_desc: &FontDescription)
fn set_font_desc(&self, font_desc: &FontDescription)
Sourcefn set_font_map(&self, fontmap: Option<&impl IsA<FontMap>>)
fn set_font_map(&self, fontmap: Option<&impl IsA<FontMap>>)
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);§fontmap
Sourcefn set_language(&self, language: &str)
Available on crate feature v3_24 only.
fn set_language(&self, language: &str)
v3_24 only.Sourcefn set_level(&self, level: FontChooserLevel)
Available on crate feature v3_24 only.
fn set_level(&self, level: FontChooserLevel)
v3_24 only.Sourcefn set_preview_text(&self, text: &str)
fn set_preview_text(&self, text: &str)
Sets the text displayed in the preview area.
The text is used to show how the selected font looks.
§text
the text to display in the preview area
Sourcefn set_show_preview_entry(&self, show_preview_entry: bool)
fn set_show_preview_entry(&self, show_preview_entry: bool)
Shows or hides the editable preview entry.
§show_preview_entry
whether to show the editable preview entry or not
Sourcefn connect_font_activated<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_font_activated<F: Fn(&Self, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
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.
§fontname
the font name
fn connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_font_desc_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_font_features_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
v3_24 only.fn connect_language_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
v3_24 only.fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
v3_24 only.fn connect_preview_text_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_show_preview_entry_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".