1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// This file was generated by gir (9e3f4cc) from gir-files (0bcaef9)
// DO NOT EDIT

use Context;
use Font;
use FontDescription;
use Fontset;
use Language;
use ffi;
use glib::object::IsA;
use glib::translate::*;

glib_wrapper! {
    pub struct FontMap(Object<ffi::PangoFontMap>);

    match fn {
        get_type => || ffi::pango_font_map_get_type(),
    }
}

pub trait FontMapExt {
    #[cfg(feature = "v1_34")]
    fn changed(&self);

    fn create_context(&self) -> Option<Context>;

    #[cfg(feature = "v1_32_4")]
    fn get_serial(&self) -> u32;

    fn get_shape_engine_type(&self) -> Option<String>;

    //fn list_families(&self, families: /*Unimplemented*/Vec<FontFamily>) -> i32;

    fn load_font(&self, context: &Context, desc: &FontDescription) -> Option<Font>;

    fn load_fontset(&self, context: &Context, desc: &FontDescription, language: &Language) -> Option<Fontset>;
}

impl<O: IsA<FontMap>> FontMapExt for O {
    #[cfg(feature = "v1_34")]
    fn changed(&self) {
        unsafe {
            ffi::pango_font_map_changed(self.to_glib_none().0);
        }
    }

    fn create_context(&self) -> Option<Context> {
        unsafe {
            from_glib_full(ffi::pango_font_map_create_context(self.to_glib_none().0))
        }
    }

    #[cfg(feature = "v1_32_4")]
    fn get_serial(&self) -> u32 {
        unsafe {
            ffi::pango_font_map_get_serial(self.to_glib_none().0)
        }
    }

    fn get_shape_engine_type(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::pango_font_map_get_shape_engine_type(self.to_glib_none().0))
        }
    }

    //fn list_families(&self, families: /*Unimplemented*/Vec<FontFamily>) -> i32 {
    //    unsafe { TODO: call ffi::pango_font_map_list_families() }
    //}

    fn load_font(&self, context: &Context, desc: &FontDescription) -> Option<Font> {
        unsafe {
            from_glib_full(ffi::pango_font_map_load_font(self.to_glib_none().0, context.to_glib_none().0, desc.to_glib_none().0))
        }
    }

    fn load_fontset(&self, context: &Context, desc: &FontDescription, language: &Language) -> Option<Fontset> {
        unsafe {
            from_glib_full(ffi::pango_font_map_load_fontset(self.to_glib_none().0, context.to_glib_none().0, desc.to_glib_none().0, mut_override(language.to_glib_none().0)))
        }
    }
}