pangocairo/auto/
functions.rs1use cairo;
6use glib::object::IsA;
7use glib::translate::*;
8use pango;
9use pango_cairo_sys;
10
11pub fn context_get_resolution(context: &pango::Context) -> f64 {
12 unsafe { pango_cairo_sys::pango_cairo_context_get_resolution(context.to_glib_none().0) }
13}
14
15pub fn context_set_font_options(context: &pango::Context, options: Option<&cairo::FontOptions>) {
20 unsafe {
21 pango_cairo_sys::pango_cairo_context_set_font_options(
22 context.to_glib_none().0,
23 options.to_glib_none().0,
24 );
25 }
26}
27
28pub fn context_set_resolution(context: &pango::Context, dpi: f64) {
29 unsafe {
30 pango_cairo_sys::pango_cairo_context_set_resolution(context.to_glib_none().0, dpi);
31 }
32}
33
34pub fn create_context(cr: &cairo::Context) -> Option<pango::Context> {
39 unsafe {
40 from_glib_full(pango_cairo_sys::pango_cairo_create_context(mut_override(
41 cr.to_glib_none().0,
42 )))
43 }
44}
45
46pub fn create_layout(cr: &cairo::Context) -> Option<pango::Layout> {
47 unsafe {
48 from_glib_full(pango_cairo_sys::pango_cairo_create_layout(mut_override(
49 cr.to_glib_none().0,
50 )))
51 }
52}
53
54pub fn error_underline_path(cr: &cairo::Context, x: f64, y: f64, width: f64, height: f64) {
55 unsafe {
56 pango_cairo_sys::pango_cairo_error_underline_path(
57 mut_override(cr.to_glib_none().0),
58 x,
59 y,
60 width,
61 height,
62 );
63 }
64}
65
66pub fn glyph_string_path<P: IsA<pango::Font>>(
67 cr: &cairo::Context,
68 font: &P,
69 glyphs: &mut pango::GlyphString,
70) {
71 unsafe {
72 pango_cairo_sys::pango_cairo_glyph_string_path(
73 mut_override(cr.to_glib_none().0),
74 font.as_ref().to_glib_none().0,
75 glyphs.to_glib_none_mut().0,
76 );
77 }
78}
79
80pub fn layout_line_path(cr: &cairo::Context, line: &pango::LayoutLine) {
81 unsafe {
82 pango_cairo_sys::pango_cairo_layout_line_path(
83 mut_override(cr.to_glib_none().0),
84 line.to_glib_none().0,
85 );
86 }
87}
88
89pub fn layout_path(cr: &cairo::Context, layout: &pango::Layout) {
90 unsafe {
91 pango_cairo_sys::pango_cairo_layout_path(
92 mut_override(cr.to_glib_none().0),
93 layout.to_glib_none().0,
94 );
95 }
96}
97
98pub fn show_error_underline(cr: &cairo::Context, x: f64, y: f64, width: f64, height: f64) {
99 unsafe {
100 pango_cairo_sys::pango_cairo_show_error_underline(
101 mut_override(cr.to_glib_none().0),
102 x,
103 y,
104 width,
105 height,
106 );
107 }
108}
109
110pub fn show_glyph_item(cr: &cairo::Context, text: &str, glyph_item: &mut pango::GlyphItem) {
111 unsafe {
112 pango_cairo_sys::pango_cairo_show_glyph_item(
113 mut_override(cr.to_glib_none().0),
114 text.to_glib_none().0,
115 glyph_item.to_glib_none_mut().0,
116 );
117 }
118}
119
120pub fn show_glyph_string<P: IsA<pango::Font>>(
121 cr: &cairo::Context,
122 font: &P,
123 glyphs: &mut pango::GlyphString,
124) {
125 unsafe {
126 pango_cairo_sys::pango_cairo_show_glyph_string(
127 mut_override(cr.to_glib_none().0),
128 font.as_ref().to_glib_none().0,
129 glyphs.to_glib_none_mut().0,
130 );
131 }
132}
133
134pub fn show_layout(cr: &cairo::Context, layout: &pango::Layout) {
135 unsafe {
136 pango_cairo_sys::pango_cairo_show_layout(
137 mut_override(cr.to_glib_none().0),
138 layout.to_glib_none().0,
139 );
140 }
141}
142
143pub fn show_layout_line(cr: &cairo::Context, line: &pango::LayoutLine) {
144 unsafe {
145 pango_cairo_sys::pango_cairo_show_layout_line(
146 mut_override(cr.to_glib_none().0),
147 line.to_glib_none().0,
148 );
149 }
150}
151
152pub fn update_context(cr: &cairo::Context, context: &pango::Context) {
153 unsafe {
154 pango_cairo_sys::pango_cairo_update_context(
155 mut_override(cr.to_glib_none().0),
156 context.to_glib_none().0,
157 );
158 }
159}
160
161pub fn update_layout(cr: &cairo::Context, layout: &pango::Layout) {
162 unsafe {
163 pango_cairo_sys::pango_cairo_update_layout(
164 mut_override(cr.to_glib_none().0),
165 layout.to_glib_none().0,
166 );
167 }
168}