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 crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10    pub struct FontMetrics(Shared<ffi::PangoFontMetrics>);
11
12    match fn {
13        ref => |ptr| ffi::pango_font_metrics_ref(ptr),
14        unref => |ptr| ffi::pango_font_metrics_unref(ptr),
15        type_ => || ffi::pango_font_metrics_get_type(),
16    }
17}
18
19impl FontMetrics {
20    #[doc(alias = "pango_font_metrics_get_approximate_char_width")]
21    #[doc(alias = "get_approximate_char_width")]
22    pub fn approximate_char_width(&self) -> i32 {
23        unsafe { ffi::pango_font_metrics_get_approximate_char_width(self.to_glib_none().0) }
24    }
25
26    #[doc(alias = "pango_font_metrics_get_approximate_digit_width")]
27    #[doc(alias = "get_approximate_digit_width")]
28    pub fn approximate_digit_width(&self) -> i32 {
29        unsafe { ffi::pango_font_metrics_get_approximate_digit_width(self.to_glib_none().0) }
30    }
31
32    #[doc(alias = "pango_font_metrics_get_ascent")]
33    #[doc(alias = "get_ascent")]
34    pub fn ascent(&self) -> i32 {
35        unsafe { ffi::pango_font_metrics_get_ascent(self.to_glib_none().0) }
36    }
37
38    #[doc(alias = "pango_font_metrics_get_descent")]
39    #[doc(alias = "get_descent")]
40    pub fn descent(&self) -> i32 {
41        unsafe { ffi::pango_font_metrics_get_descent(self.to_glib_none().0) }
42    }
43
44    #[cfg(feature = "v1_44")]
45    #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
46    #[doc(alias = "pango_font_metrics_get_height")]
47    #[doc(alias = "get_height")]
48    pub fn height(&self) -> i32 {
49        unsafe { ffi::pango_font_metrics_get_height(self.to_glib_none().0) }
50    }
51
52    #[doc(alias = "pango_font_metrics_get_strikethrough_position")]
53    #[doc(alias = "get_strikethrough_position")]
54    pub fn strikethrough_position(&self) -> i32 {
55        unsafe { ffi::pango_font_metrics_get_strikethrough_position(self.to_glib_none().0) }
56    }
57
58    #[doc(alias = "pango_font_metrics_get_strikethrough_thickness")]
59    #[doc(alias = "get_strikethrough_thickness")]
60    pub fn strikethrough_thickness(&self) -> i32 {
61        unsafe { ffi::pango_font_metrics_get_strikethrough_thickness(self.to_glib_none().0) }
62    }
63
64    #[doc(alias = "pango_font_metrics_get_underline_position")]
65    #[doc(alias = "get_underline_position")]
66    pub fn underline_position(&self) -> i32 {
67        unsafe { ffi::pango_font_metrics_get_underline_position(self.to_glib_none().0) }
68    }
69
70    #[doc(alias = "pango_font_metrics_get_underline_thickness")]
71    #[doc(alias = "get_underline_thickness")]
72    pub fn underline_thickness(&self) -> i32 {
73        unsafe { ffi::pango_font_metrics_get_underline_thickness(self.to_glib_none().0) }
74    }
75}