1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
// 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::{ffi, Document, FontsIter};
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 {
/// Creates a new [`FontInfo`][crate::FontInfo] object
/// ## `document`
/// a [`Document`][crate::Document]
///
/// # Returns
///
/// a new [`FontInfo`][crate::FontInfo] instance
#[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)) }
}
/// Scans the document associated with `self` for fonts. At most
/// `n_pages` will be scanned starting from the current iterator. `iter` will
/// point to the first font scanned.
///
/// Here is a simple example of code to scan fonts in a document
///
/// `<informalexample>``<programlisting>`
/// font_info = poppler_font_info_new (document);
/// while (poppler_font_info_scan (font_info, 20, &fonts_iter)) {
/// if (!fonts_iter)
/// continue; /<!-- -->* No fonts found in these 20 pages *<!-- -->/
/// do {
/// /<!-- -->* Do something with font iter *<!-- -->/
/// g_print ("Font Name: `s`\n", poppler_fonts_iter_get_name (fonts_iter));
/// } while (poppler_fonts_iter_next (fonts_iter));
/// poppler_fonts_iter_free (fonts_iter);
/// }
/// `</programlisting>``</informalexample>`
/// ## `n_pages`
/// number of pages to scan
///
/// # Returns
///
/// [`true`], if there are more fonts left to scan
///
/// ## `iter`
/// return location for a [`FontsIter`][crate::FontsIter]
#[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
}
}
}
}