pub trait FontChooserExt:
IsA<FontChooser>
+ Sealed
+ '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) -> GString { ... }
fn font_map(&self) -> Option<FontMap> { ... }
fn font_size(&self) -> i32 { ... }
fn language(&self) -> GString { ... }
fn level(&self) -> FontChooserLevel { ... }
fn preview_text(&self) -> GString { ... }
fn shows_preview_entry(&self) -> bool { ... }
fn set_filter_func<P: Fn(&FontFamily, &FontFace) -> bool + 'static>(
&self,
filter: P,
) { ... }
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>
👎Deprecated: Since 4.10
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::FontDescription::equal()
if you want to compare two
font descriptions.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
A string with the name of the current font
sourcefn font_desc(&self) -> Option<FontDescription>
👎Deprecated: Since 4.10
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::FontDescription::equal()
if you want to compare two
font descriptions.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
A pango::FontDescription
for the
current font
sourcefn font_face(&self) -> Option<FontFace>
👎Deprecated: Since 4.10
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
.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
A pango::FontFace
representing the
selected font group details
sourcefn font_family(&self) -> Option<FontFamily>
👎Deprecated: Since 4.10
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
.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
A pango::FontFamily
representing the
selected font family
sourcefn font_features(&self) -> GString
👎Deprecated: Since 4.10
fn font_features(&self) -> GString
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 Pango::AttrFontFeatures::new()
.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
the currently selected font features
sourcefn font_map(&self) -> Option<FontMap>
👎Deprecated: Since 4.10
fn font_map(&self) -> Option<FontMap>
Gets the custom font map of this font chooser widget,
or None
if it does not have one.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
sourcefn font_size(&self) -> i32
👎Deprecated: Since 4.10
fn font_size(&self) -> i32
The selected font size.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
A n integer representing the selected font size, or -1 if no font size is selected.
sourcefn language(&self) -> GString
👎Deprecated: Since 4.10
fn language(&self) -> GString
Gets the language that is used for font features.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
the currently selected language
sourcefn level(&self) -> FontChooserLevel
👎Deprecated: Since 4.10
fn level(&self) -> FontChooserLevel
Returns the current level of granularity for selecting fonts.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
the current granularity level
sourcefn preview_text(&self) -> GString
👎Deprecated: Since 4.10
fn preview_text(&self) -> GString
Gets the text displayed in the preview area.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
the text displayed in the preview area
sourcefn shows_preview_entry(&self) -> bool
👎Deprecated: Since 4.10
fn shows_preview_entry(&self) -> bool
Returns whether the preview entry is shown or not.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§Returns
true
if the preview entry is shown or false
if it is hidden.
sourcefn set_filter_func<P: Fn(&FontFamily, &FontFace) -> bool + 'static>(
&self,
filter: P,
)
👎Deprecated: Since 4.10
fn set_filter_func<P: Fn(&FontFamily, &FontFace) -> bool + 'static>( &self, filter: P, )
Adds a filter function that decides which fonts to display in the font chooser.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§filter
a GtkFontFilterFunc
sourcefn set_font(&self, fontname: &str)
👎Deprecated: Since 4.10
fn set_font(&self, fontname: &str)
Sets the currently-selected font.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§fontname
a font name like “Helvetica 12” or “Times Bold 18”
sourcefn set_font_desc(&self, font_desc: &FontDescription)
👎Deprecated: Since 4.10
fn set_font_desc(&self, font_desc: &FontDescription)
Sets the currently-selected font from @font_desc.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§font_desc
sourcefn set_font_map(&self, fontmap: Option<&impl IsA<FontMap>>)
👎Deprecated: Since 4.10
fn set_font_map(&self, fontmap: Option<&impl IsA<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.
⚠️ The following code is in 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:
⚠️ The following code is in c ⚠️
context = gtk_widget_get_pango_context (label);
pango_context_set_font_map (context, fontmap);
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§fontmap
sourcefn set_language(&self, language: &str)
👎Deprecated: Since 4.10
fn set_language(&self, language: &str)
Sets the language to use for font features.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§language
a language
sourcefn set_level(&self, level: FontChooserLevel)
👎Deprecated: Since 4.10
fn set_level(&self, level: FontChooserLevel)
Sets the desired level of granularity for selecting fonts.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§level
the desired level of granularity
sourcefn set_preview_text(&self, text: &str)
👎Deprecated: Since 4.10
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.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§text
the text to display in the preview area
sourcefn set_show_preview_entry(&self, show_preview_entry: bool)
👎Deprecated: Since 4.10
fn set_show_preview_entry(&self, show_preview_entry: bool)
Shows or hides the editable preview entry.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§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
👎Deprecated: Since 4.10
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.
§Deprecated since 4.10
Use FontDialog
and FontDialogButton
instead
§fontname
the font name