1 // Take a look at the license at the top of the repository in the LICENSE file.
2 
3 use crate::AttrIterator;
4 use crate::Attribute;
5 use crate::FontDescription;
6 use crate::Language;
7 use glib::translate::*;
8 
9 use std::ptr;
10 
11 impl AttrIterator {
12     #[doc(alias = "pango_attr_iterator_get_font")]
13     #[doc(alias = "get_font")]
font( &mut self, desc: &mut FontDescription, language: Option<&Language>, extra_attrs: &[&Attribute], )14     pub fn font(
15         &mut self,
16         desc: &mut FontDescription,
17         language: Option<&Language>,
18         extra_attrs: &[&Attribute],
19     ) {
20         unsafe {
21             let stash_vec: Vec<_> = extra_attrs.iter().rev().map(|v| v.to_glib_none()).collect();
22             let mut list: *mut glib::ffi::GSList = ptr::null_mut();
23             for stash in &stash_vec {
24                 list = glib::ffi::g_slist_prepend(list, Ptr::to(stash.0));
25             }
26 
27             ffi::pango_attr_iterator_get_font(
28                 self.to_glib_none_mut().0,
29                 desc.to_glib_none_mut().0,
30                 &mut language.to_glib_none().0,
31                 &mut list,
32             );
33         }
34     }
35 }
36