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 
5 use crate::FontDescription;
6 #[cfg(any(feature = "v1_46", feature = "dox"))]
7 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_46")))]
8 use crate::FontFamily;
9 use glib::object::IsA;
10 use glib::translate::*;
11 use std::fmt;
12 use std::mem;
13 use std::ptr;
14 
15 glib::wrapper! {
16     #[doc(alias = "PangoFontFace")]
17     pub struct FontFace(Object<ffi::PangoFontFace, ffi::PangoFontFaceClass>);
18 
19     match fn {
20         type_ => || ffi::pango_font_face_get_type(),
21     }
22 }
23 
24 pub const NONE_FONT_FACE: Option<&FontFace> = None;
25 
26 pub trait FontFaceExt: 'static {
27     #[doc(alias = "pango_font_face_describe")]
describe(&self) -> Option<FontDescription>28     fn describe(&self) -> Option<FontDescription>;
29 
30     #[doc(alias = "pango_font_face_get_face_name")]
31     #[doc(alias = "get_face_name")]
face_name(&self) -> Option<glib::GString>32     fn face_name(&self) -> Option<glib::GString>;
33 
34     #[cfg(any(feature = "v1_46", feature = "dox"))]
35     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_46")))]
36     #[doc(alias = "pango_font_face_get_family")]
37     #[doc(alias = "get_family")]
family(&self) -> Option<FontFamily>38     fn family(&self) -> Option<FontFamily>;
39 
40     #[doc(alias = "pango_font_face_is_synthesized")]
is_synthesized(&self) -> bool41     fn is_synthesized(&self) -> bool;
42 
43     #[doc(alias = "pango_font_face_list_sizes")]
list_sizes(&self) -> Vec<i32>44     fn list_sizes(&self) -> Vec<i32>;
45 }
46 
47 impl<O: IsA<FontFace>> FontFaceExt for O {
describe(&self) -> Option<FontDescription>48     fn describe(&self) -> Option<FontDescription> {
49         unsafe {
50             from_glib_full(ffi::pango_font_face_describe(
51                 self.as_ref().to_glib_none().0,
52             ))
53         }
54     }
55 
face_name(&self) -> Option<glib::GString>56     fn face_name(&self) -> Option<glib::GString> {
57         unsafe {
58             from_glib_none(ffi::pango_font_face_get_face_name(
59                 self.as_ref().to_glib_none().0,
60             ))
61         }
62     }
63 
64     #[cfg(any(feature = "v1_46", feature = "dox"))]
65     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_46")))]
family(&self) -> Option<FontFamily>66     fn family(&self) -> Option<FontFamily> {
67         unsafe {
68             from_glib_none(ffi::pango_font_face_get_family(
69                 self.as_ref().to_glib_none().0,
70             ))
71         }
72     }
73 
is_synthesized(&self) -> bool74     fn is_synthesized(&self) -> bool {
75         unsafe {
76             from_glib(ffi::pango_font_face_is_synthesized(
77                 self.as_ref().to_glib_none().0,
78             ))
79         }
80     }
81 
list_sizes(&self) -> Vec<i32>82     fn list_sizes(&self) -> Vec<i32> {
83         unsafe {
84             let mut sizes = ptr::null_mut();
85             let mut n_sizes = mem::MaybeUninit::uninit();
86             ffi::pango_font_face_list_sizes(
87                 self.as_ref().to_glib_none().0,
88                 &mut sizes,
89                 n_sizes.as_mut_ptr(),
90             );
91             FromGlibContainer::from_glib_full_num(sizes, n_sizes.assume_init() as usize)
92         }
93     }
94 }
95 
96 impl fmt::Display for FontFace {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result97     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
98         f.write_str("FontFace")
99     }
100 }
101