pango/auto/
font_metrics.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use glib::translate::*;
6use pango_sys;
7
8glib_wrapper! {
9    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10    pub struct FontMetrics(Shared<pango_sys::PangoFontMetrics>);
11
12    match fn {
13        ref => |ptr| pango_sys::pango_font_metrics_ref(ptr),
14        unref => |ptr| pango_sys::pango_font_metrics_unref(ptr),
15        get_type => || pango_sys::pango_font_metrics_get_type(),
16    }
17}
18
19impl FontMetrics {
20    pub fn new() -> FontMetrics {
21        unsafe { from_glib_full(pango_sys::pango_font_metrics_new()) }
22    }
23
24    pub fn get_approximate_char_width(&self) -> i32 {
25        unsafe { pango_sys::pango_font_metrics_get_approximate_char_width(self.to_glib_none().0) }
26    }
27
28    pub fn get_approximate_digit_width(&self) -> i32 {
29        unsafe { pango_sys::pango_font_metrics_get_approximate_digit_width(self.to_glib_none().0) }
30    }
31
32    pub fn get_ascent(&self) -> i32 {
33        unsafe { pango_sys::pango_font_metrics_get_ascent(self.to_glib_none().0) }
34    }
35
36    pub fn get_descent(&self) -> i32 {
37        unsafe { pango_sys::pango_font_metrics_get_descent(self.to_glib_none().0) }
38    }
39
40    pub fn get_strikethrough_position(&self) -> i32 {
41        unsafe { pango_sys::pango_font_metrics_get_strikethrough_position(self.to_glib_none().0) }
42    }
43
44    pub fn get_strikethrough_thickness(&self) -> i32 {
45        unsafe { pango_sys::pango_font_metrics_get_strikethrough_thickness(self.to_glib_none().0) }
46    }
47
48    pub fn get_underline_position(&self) -> i32 {
49        unsafe { pango_sys::pango_font_metrics_get_underline_position(self.to_glib_none().0) }
50    }
51
52    pub fn get_underline_thickness(&self) -> i32 {
53        unsafe { pango_sys::pango_font_metrics_get_underline_thickness(self.to_glib_none().0) }
54    }
55}
56
57impl Default for FontMetrics {
58    fn default() -> Self {
59        Self::new()
60    }
61}