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 glib::object::IsA; 6 use glib::translate::*; 7 use glib::GString; 8 use pango_sys; 9 use std::fmt; 10 use std::mem; 11 use std::ptr; 12 use FontDescription; 13 14 glib_wrapper! { 15 pub struct FontFace(Object<pango_sys::PangoFontFace, pango_sys::PangoFontFaceClass, FontFaceClass>); 16 17 match fn { 18 get_type => || pango_sys::pango_font_face_get_type(), 19 } 20 } 21 22 pub const NONE_FONT_FACE: Option<&FontFace> = None; 23 24 pub trait FontFaceExt: 'static { describe(&self) -> Option<FontDescription>25 fn describe(&self) -> Option<FontDescription>; 26 get_face_name(&self) -> Option<GString>27 fn get_face_name(&self) -> Option<GString>; 28 is_synthesized(&self) -> bool29 fn is_synthesized(&self) -> bool; 30 list_sizes(&self) -> Vec<i32>31 fn list_sizes(&self) -> Vec<i32>; 32 } 33 34 impl<O: IsA<FontFace>> FontFaceExt for O { describe(&self) -> Option<FontDescription>35 fn describe(&self) -> Option<FontDescription> { 36 unsafe { 37 from_glib_full(pango_sys::pango_font_face_describe( 38 self.as_ref().to_glib_none().0, 39 )) 40 } 41 } 42 get_face_name(&self) -> Option<GString>43 fn get_face_name(&self) -> Option<GString> { 44 unsafe { 45 from_glib_none(pango_sys::pango_font_face_get_face_name( 46 self.as_ref().to_glib_none().0, 47 )) 48 } 49 } 50 is_synthesized(&self) -> bool51 fn is_synthesized(&self) -> bool { 52 unsafe { 53 from_glib(pango_sys::pango_font_face_is_synthesized( 54 self.as_ref().to_glib_none().0, 55 )) 56 } 57 } 58 list_sizes(&self) -> Vec<i32>59 fn list_sizes(&self) -> Vec<i32> { 60 unsafe { 61 let mut sizes = ptr::null_mut(); 62 let mut n_sizes = mem::MaybeUninit::uninit(); 63 pango_sys::pango_font_face_list_sizes( 64 self.as_ref().to_glib_none().0, 65 &mut sizes, 66 n_sizes.as_mut_ptr(), 67 ); 68 FromGlibContainer::from_glib_full_num(sizes, n_sizes.assume_init() as usize) 69 } 70 } 71 } 72 73 impl fmt::Display for FontFace { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result74 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 75 write!(f, "FontFace") 76 } 77 } 78