// 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::{Color, ffi};
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct TextSpan(Boxed<ffi::PopplerTextSpan>);

    match fn {
        copy => |ptr| ffi::poppler_text_span_copy(mut_override(ptr)),
        free => |ptr| ffi::poppler_text_span_free(ptr),
        type_ => || ffi::poppler_text_span_get_type(),
    }
}

impl TextSpan {
    #[doc(alias = "poppler_text_span_get_color")]
    #[doc(alias = "get_color")]
    pub fn color(&mut self) -> Color {
        unsafe {
            let mut color = Color::uninitialized();
            ffi::poppler_text_span_get_color(self.to_glib_none_mut().0, color.to_glib_none_mut().0);
            color
        }
    }

    #[doc(alias = "poppler_text_span_get_font_name")]
    #[doc(alias = "get_font_name")]
    pub fn font_name(&mut self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::poppler_text_span_get_font_name(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "poppler_text_span_get_text")]
    #[doc(alias = "get_text")]
    pub fn text(&mut self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::poppler_text_span_get_text(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "poppler_text_span_is_bold_font")]
    pub fn is_bold_font(&mut self) -> bool {
        unsafe {
            from_glib(ffi::poppler_text_span_is_bold_font(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "poppler_text_span_is_fixed_width_font")]
    pub fn is_fixed_width_font(&mut self) -> bool {
        unsafe {
            from_glib(ffi::poppler_text_span_is_fixed_width_font(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "poppler_text_span_is_serif_font")]
    pub fn is_serif_font(&mut self) -> bool {
        unsafe {
            from_glib(ffi::poppler_text_span_is_serif_font(
                self.to_glib_none_mut().0,
            ))
        }
    }
}
