Trait pango::prelude::FontMapExt[][src]

pub trait FontMapExt: 'static {
    fn changed(&self);
fn create_context(&self) -> Option<Context>;
fn family(&self, name: &str) -> Option<FontFamily>;
fn serial(&self) -> u32;
fn list_families(&self) -> Vec<FontFamily>;
fn load_font(
        &self,
        context: &Context,
        desc: &FontDescription
    ) -> Option<Font>;
fn load_fontset(
        &self,
        context: &Context,
        desc: &FontDescription,
        language: &Language
    ) -> Option<Fontset>; }
Expand description

Trait containing all FontMap methods.

Implementors

FontMap

Required methods

Forces a change in the context, which will cause any Context using this fontmap to change.

This function is only useful when implementing a new backend for Pango, something applications won’t do. Backends should call this function if they have attached extra data to the context and such data is changed.

Creates a Context connected to self. This is equivalent to Context::new() followed by Context::set_font_map().

If you are using Pango as part of a higher-level system, that system may have it’s own way of create a Context. For instance, the GTK+ toolkit has, among others, gdk_pango_context_get_for_screen(), and gtk_widget_get_pango_context(). Use those instead.

Returns

the newly allocated Context, which should be freed with g_object_unref().

This is supported on crate feature v1_46 only.

Gets a font family by name.

name

a family name

Returns

the FontFamily

Returns the current serial number of self. The serial number is initialized to an small number larger than zero when a new fontmap is created and is increased whenever the fontmap is changed. It may wrap, but will never have the value 0. Since it can wrap, never compare it with “less than”, always use “not equals”.

The fontmap can only be changed using backend-specific API, like changing fontmap resolution.

This can be used to automatically detect changes to a FontMap, like in Context.

Returns

The current serial number of self.

List all families for a fontmap.

Returns

families

location to store a pointer to an array of FontFamily *. This array should be freed with g_free().

Load the font in the fontmap that is the closest match for desc.

context

the Context the font will be used with

desc

a FontDescription describing the font to load

Returns

the newly allocated Font loaded, or None if no font matched.

Load a set of fonts in the fontmap that can be used to render a font matching desc.

context

the Context the font will be used with

desc

a FontDescription describing the font to load

language

a Language the fonts will be used for

Returns

the newly allocated Fontset loaded, or None if no font matched.

Implementors