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
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use cairo;
use glib::object::IsA;
use glib::translate::*;
use pango;
use pango_cairo_sys;

pub fn context_get_resolution(context: &pango::Context) -> f64 {
    unsafe { pango_cairo_sys::pango_cairo_context_get_resolution(context.to_glib_none().0) }
}

//pub fn context_get_shape_renderer(context: &pango::Context, data: /*Unimplemented*/Option<Fundamental: Pointer>) -> /*Unimplemented*/Fn(&cairo::Context, /*Ignored*/pango::AttrShape, bool, /*Unimplemented*/Option<Fundamental: Pointer>) {
//    unsafe { TODO: call pango_cairo_sys:pango_cairo_context_get_shape_renderer() }
//}

pub fn context_set_font_options(context: &pango::Context, options: Option<&cairo::FontOptions>) {
    unsafe {
        pango_cairo_sys::pango_cairo_context_set_font_options(
            context.to_glib_none().0,
            options.to_glib_none().0,
        );
    }
}

pub fn context_set_resolution(context: &pango::Context, dpi: f64) {
    unsafe {
        pango_cairo_sys::pango_cairo_context_set_resolution(context.to_glib_none().0, dpi);
    }
}

//pub fn context_set_shape_renderer(context: &pango::Context, func: /*Unimplemented*/Fn(&cairo::Context, /*Ignored*/pango::AttrShape, bool, /*Unimplemented*/Option<Fundamental: Pointer>), data: /*Unimplemented*/Option<Fundamental: Pointer>) {
//    unsafe { TODO: call pango_cairo_sys:pango_cairo_context_set_shape_renderer() }
//}

pub fn create_context(cr: &cairo::Context) -> Option<pango::Context> {
    unsafe {
        from_glib_full(pango_cairo_sys::pango_cairo_create_context(mut_override(
            cr.to_glib_none().0,
        )))
    }
}

pub fn create_layout(cr: &cairo::Context) -> Option<pango::Layout> {
    unsafe {
        from_glib_full(pango_cairo_sys::pango_cairo_create_layout(mut_override(
            cr.to_glib_none().0,
        )))
    }
}

pub fn error_underline_path(cr: &cairo::Context, x: f64, y: f64, width: f64, height: f64) {
    unsafe {
        pango_cairo_sys::pango_cairo_error_underline_path(
            mut_override(cr.to_glib_none().0),
            x,
            y,
            width,
            height,
        );
    }
}

pub fn glyph_string_path<P: IsA<pango::Font>>(
    cr: &cairo::Context,
    font: &P,
    glyphs: &mut pango::GlyphString,
) {
    unsafe {
        pango_cairo_sys::pango_cairo_glyph_string_path(
            mut_override(cr.to_glib_none().0),
            font.as_ref().to_glib_none().0,
            glyphs.to_glib_none_mut().0,
        );
    }
}

pub fn layout_line_path(cr: &cairo::Context, line: &pango::LayoutLine) {
    unsafe {
        pango_cairo_sys::pango_cairo_layout_line_path(
            mut_override(cr.to_glib_none().0),
            line.to_glib_none().0,
        );
    }
}

pub fn layout_path(cr: &cairo::Context, layout: &pango::Layout) {
    unsafe {
        pango_cairo_sys::pango_cairo_layout_path(
            mut_override(cr.to_glib_none().0),
            layout.to_glib_none().0,
        );
    }
}

pub fn show_error_underline(cr: &cairo::Context, x: f64, y: f64, width: f64, height: f64) {
    unsafe {
        pango_cairo_sys::pango_cairo_show_error_underline(
            mut_override(cr.to_glib_none().0),
            x,
            y,
            width,
            height,
        );
    }
}

pub fn show_glyph_item(cr: &cairo::Context, text: &str, glyph_item: &mut pango::GlyphItem) {
    unsafe {
        pango_cairo_sys::pango_cairo_show_glyph_item(
            mut_override(cr.to_glib_none().0),
            text.to_glib_none().0,
            glyph_item.to_glib_none_mut().0,
        );
    }
}

pub fn show_glyph_string<P: IsA<pango::Font>>(
    cr: &cairo::Context,
    font: &P,
    glyphs: &mut pango::GlyphString,
) {
    unsafe {
        pango_cairo_sys::pango_cairo_show_glyph_string(
            mut_override(cr.to_glib_none().0),
            font.as_ref().to_glib_none().0,
            glyphs.to_glib_none_mut().0,
        );
    }
}

pub fn show_layout(cr: &cairo::Context, layout: &pango::Layout) {
    unsafe {
        pango_cairo_sys::pango_cairo_show_layout(
            mut_override(cr.to_glib_none().0),
            layout.to_glib_none().0,
        );
    }
}

pub fn show_layout_line(cr: &cairo::Context, line: &pango::LayoutLine) {
    unsafe {
        pango_cairo_sys::pango_cairo_show_layout_line(
            mut_override(cr.to_glib_none().0),
            line.to_glib_none().0,
        );
    }
}

pub fn update_context(cr: &cairo::Context, context: &pango::Context) {
    unsafe {
        pango_cairo_sys::pango_cairo_update_context(
            mut_override(cr.to_glib_none().0),
            context.to_glib_none().0,
        );
    }
}

pub fn update_layout(cr: &cairo::Context, layout: &pango::Layout) {
    unsafe {
        pango_cairo_sys::pango_cairo_update_layout(
            mut_override(cr.to_glib_none().0),
            layout.to_glib_none().0,
        );
    }
}