pango::prelude

Trait FontFamilyExt

Source
pub trait FontFamilyExt: IsA<FontFamily> + 'static {
    // Provided methods
    fn face(&self, name: Option<&str>) -> Option<FontFace> { ... }
    fn name(&self) -> GString { ... }
    fn is_monospace(&self) -> bool { ... }
    fn is_variable(&self) -> bool { ... }
    fn list_faces(&self) -> Vec<FontFace> { ... }
    fn connect_is_monospace_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_is_variable_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_name_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all FontFamily methods.

§Implementors

FontFamily

Provided Methods§

Source

fn face(&self, name: Option<&str>) -> Option<FontFace>

Available on crate feature v1_46 only.

Gets the FontFace of @self with the given name.

§name

the name of a face. If the name is None, the family’s default face (fontconfig calls it “Regular”) will be returned.

§Returns

the FontFace, or None if no face with the given name exists.

Source

fn name(&self) -> GString

Gets the name of the family.

The name is unique among all fonts for the font backend and can be used in a FontDescription to specify that a face from this family is desired.

§Returns

the name of the family. This string is owned by the family object and must not be modified or freed.

Source

fn is_monospace(&self) -> bool

A monospace font is a font designed for text display where the the characters form a regular grid.

For Western languages this would mean that the advance width of all characters are the same, but this categorization also includes Asian fonts which include double-width characters: characters that occupy two grid cells. g_unichar_iswide() returns a result that indicates whether a character is typically double-width in a monospace font.

The best way to find out the grid-cell size is to call FontMetrics::approximate_digit_width(), since the results of FontMetrics::approximate_char_width() may be affected by double-width characters.

§Returns

true if the family is monospace.

Source

fn is_variable(&self) -> bool

Available on crate feature v1_44 only.

A variable font is a font which has axes that can be modified to produce different faces.

Such axes are also known as variations; see FontDescription::set_variations() for more information.

§Returns

true if the family is variable

Source

fn list_faces(&self) -> Vec<FontFace>

Lists the different font faces that make up @self.

The faces in a family share a common design, but differ in slant, weight, width and other aspects.

Note that the returned faces are not in any particular order, and multiple faces may have the same name or characteristics.

FontFamily also implemented the [gio::ListModel][crate::gio::ListModel] interface for enumerating faces.

§Returns
§faces

location to store an array of pointers to FontFace objects, or None. This array should be freed with g_free() when it is no longer needed.

Source

fn connect_is_monospace_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v1_52 only.
Source

fn connect_is_variable_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v1_52 only.
Source

fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Available on crate feature v1_52 only.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§