pango/auto/
font_face.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
5#[cfg(feature = "v1_46")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
7use crate::FontFamily;
8use crate::{ffi, FontDescription};
9use glib::{prelude::*, translate::*};
10
11glib::wrapper! {
12    #[doc(alias = "PangoFontFace")]
13    pub struct FontFace(Object<ffi::PangoFontFace, ffi::PangoFontFaceClass>);
14
15    match fn {
16        type_ => || ffi::pango_font_face_get_type(),
17    }
18}
19
20impl FontFace {
21    pub const NONE: Option<&'static FontFace> = None;
22}
23
24pub trait FontFaceExt: IsA<FontFace> + 'static {
25    #[doc(alias = "pango_font_face_describe")]
26    fn describe(&self) -> FontDescription {
27        unsafe {
28            from_glib_full(ffi::pango_font_face_describe(
29                self.as_ref().to_glib_none().0,
30            ))
31        }
32    }
33
34    #[doc(alias = "pango_font_face_get_face_name")]
35    #[doc(alias = "get_face_name")]
36    fn face_name(&self) -> glib::GString {
37        unsafe {
38            from_glib_none(ffi::pango_font_face_get_face_name(
39                self.as_ref().to_glib_none().0,
40            ))
41        }
42    }
43
44    #[cfg(feature = "v1_46")]
45    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
46    #[doc(alias = "pango_font_face_get_family")]
47    #[doc(alias = "get_family")]
48    fn family(&self) -> FontFamily {
49        unsafe {
50            from_glib_none(ffi::pango_font_face_get_family(
51                self.as_ref().to_glib_none().0,
52            ))
53        }
54    }
55
56    #[doc(alias = "pango_font_face_is_synthesized")]
57    fn is_synthesized(&self) -> bool {
58        unsafe {
59            from_glib(ffi::pango_font_face_is_synthesized(
60                self.as_ref().to_glib_none().0,
61            ))
62        }
63    }
64
65    #[doc(alias = "pango_font_face_list_sizes")]
66    fn list_sizes(&self) -> Vec<i32> {
67        unsafe {
68            let mut sizes = std::ptr::null_mut();
69            let mut n_sizes = std::mem::MaybeUninit::uninit();
70            ffi::pango_font_face_list_sizes(
71                self.as_ref().to_glib_none().0,
72                &mut sizes,
73                n_sizes.as_mut_ptr(),
74            );
75            FromGlibContainer::from_glib_full_num(sizes, n_sizes.assume_init() as _)
76        }
77    }
78}
79
80impl<O: IsA<FontFace>> FontFaceExt for O {}