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
// 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

#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(
    clippy::approx_constant,
    clippy::type_complexity,
    clippy::unreadable_literal,
    clippy::upper_case_acronyms
)]
#![cfg_attr(feature = "dox", feature(doc_cfg))]

#[allow(unused_imports)]
use libc::{
    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
    intptr_t, size_t, ssize_t, uintptr_t, FILE,
};

#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};

// Callbacks
pub type PangoCairoShapeRendererFunc = Option<
    unsafe extern "C" fn(*mut cairo::cairo_t, *mut pango::PangoAttrShape, gboolean, gpointer),
>;

// Interfaces
#[repr(C)]
pub struct PangoCairoFont {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for PangoCairoFont {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(f, "PangoCairoFont @ {self:p}")
    }
}

#[repr(C)]
pub struct PangoCairoFontMap {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for PangoCairoFontMap {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(f, "PangoCairoFontMap @ {self:p}")
    }
}

#[link(name = "pangocairo-1.0")]
extern "C" {

    //=========================================================================
    // PangoCairoFont
    //=========================================================================
    pub fn pango_cairo_font_get_type() -> GType;
    pub fn pango_cairo_font_get_scaled_font(
        font: *mut PangoCairoFont,
    ) -> *mut cairo::cairo_scaled_font_t;

    //=========================================================================
    // PangoCairoFontMap
    //=========================================================================
    pub fn pango_cairo_font_map_get_type() -> GType;
    pub fn pango_cairo_font_map_get_default() -> *mut pango::PangoFontMap;
    pub fn pango_cairo_font_map_new() -> *mut pango::PangoFontMap;
    pub fn pango_cairo_font_map_new_for_font_type(
        fonttype: cairo::cairo_font_type_t,
    ) -> *mut pango::PangoFontMap;
    pub fn pango_cairo_font_map_create_context(
        fontmap: *mut PangoCairoFontMap,
    ) -> *mut pango::PangoContext;
    pub fn pango_cairo_font_map_get_font_type(
        fontmap: *mut PangoCairoFontMap,
    ) -> cairo::cairo_font_type_t;
    pub fn pango_cairo_font_map_get_resolution(fontmap: *mut PangoCairoFontMap) -> c_double;
    pub fn pango_cairo_font_map_set_default(fontmap: *mut PangoCairoFontMap);
    pub fn pango_cairo_font_map_set_resolution(fontmap: *mut PangoCairoFontMap, dpi: c_double);

    //=========================================================================
    // Other functions
    //=========================================================================
    pub fn pango_cairo_context_get_font_options(
        context: *mut pango::PangoContext,
    ) -> *const cairo::cairo_font_options_t;
    pub fn pango_cairo_context_get_resolution(context: *mut pango::PangoContext) -> c_double;
    pub fn pango_cairo_context_get_shape_renderer(
        context: *mut pango::PangoContext,
        data: *mut gpointer,
    ) -> PangoCairoShapeRendererFunc;
    pub fn pango_cairo_context_set_font_options(
        context: *mut pango::PangoContext,
        options: *const cairo::cairo_font_options_t,
    );
    pub fn pango_cairo_context_set_resolution(context: *mut pango::PangoContext, dpi: c_double);
    pub fn pango_cairo_context_set_shape_renderer(
        context: *mut pango::PangoContext,
        func: PangoCairoShapeRendererFunc,
        data: gpointer,
        dnotify: glib::GDestroyNotify,
    );
    pub fn pango_cairo_create_context(cr: *mut cairo::cairo_t) -> *mut pango::PangoContext;
    pub fn pango_cairo_create_layout(cr: *mut cairo::cairo_t) -> *mut pango::PangoLayout;
    pub fn pango_cairo_error_underline_path(
        cr: *mut cairo::cairo_t,
        x: c_double,
        y: c_double,
        width: c_double,
        height: c_double,
    );
    pub fn pango_cairo_glyph_string_path(
        cr: *mut cairo::cairo_t,
        font: *mut pango::PangoFont,
        glyphs: *mut pango::PangoGlyphString,
    );
    pub fn pango_cairo_layout_line_path(cr: *mut cairo::cairo_t, line: *mut pango::PangoLayoutLine);
    pub fn pango_cairo_layout_path(cr: *mut cairo::cairo_t, layout: *mut pango::PangoLayout);
    pub fn pango_cairo_show_error_underline(
        cr: *mut cairo::cairo_t,
        x: c_double,
        y: c_double,
        width: c_double,
        height: c_double,
    );
    pub fn pango_cairo_show_glyph_item(
        cr: *mut cairo::cairo_t,
        text: *const c_char,
        glyph_item: *mut pango::PangoGlyphItem,
    );
    pub fn pango_cairo_show_glyph_string(
        cr: *mut cairo::cairo_t,
        font: *mut pango::PangoFont,
        glyphs: *mut pango::PangoGlyphString,
    );
    pub fn pango_cairo_show_layout(cr: *mut cairo::cairo_t, layout: *mut pango::PangoLayout);
    pub fn pango_cairo_show_layout_line(cr: *mut cairo::cairo_t, line: *mut pango::PangoLayoutLine);
    pub fn pango_cairo_update_context(cr: *mut cairo::cairo_t, context: *mut pango::PangoContext);
    pub fn pango_cairo_update_layout(cr: *mut cairo::cairo_t, layout: *mut pango::PangoLayout);

}