// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{Document, FontsIter, ffi};
use glib::translate::*;

glib::wrapper! {
    #[doc(alias = "PopplerFontInfo")]
    pub struct FontInfo(Object<ffi::PopplerFontInfo>);

    match fn {
        type_ => || ffi::poppler_font_info_get_type(),
    }
}

impl FontInfo {
    #[doc(alias = "poppler_font_info_new")]
    pub fn new(document: &Document) -> FontInfo {
        unsafe { from_glib_full(ffi::poppler_font_info_new(document.to_glib_none().0)) }
    }

    #[doc(alias = "poppler_font_info_scan")]
    pub fn scan(&self, n_pages: i32) -> Option<FontsIter> {
        unsafe {
            let mut iter = std::ptr::null_mut();
            let ret = from_glib(ffi::poppler_font_info_scan(
                self.to_glib_none().0,
                n_pages,
                &mut iter,
            ));
            if ret {
                Some(from_glib_full(iter))
            } else {
                None
            }
        }
    }
}
