1use crate::{ffi, AttrList};
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10 pub struct GlyphItem(Boxed<ffi::PangoGlyphItem>);
11
12 match fn {
13 copy => |ptr| ffi::pango_glyph_item_copy(mut_override(ptr)),
14 free => |ptr| ffi::pango_glyph_item_free(ptr),
15 type_ => || ffi::pango_glyph_item_get_type(),
16 }
17}
18
19impl GlyphItem {
20 #[doc(alias = "pango_glyph_item_apply_attrs")]
21 pub fn apply_attrs(self, text: &str, list: &AttrList) -> Vec<GlyphItem> {
22 unsafe {
23 FromGlibPtrContainer::from_glib_full(ffi::pango_glyph_item_apply_attrs(
24 self.into_glib_ptr(),
25 text.to_glib_none().0,
26 list.to_glib_none().0,
27 ))
28 }
29 }
30
31 #[doc(alias = "pango_glyph_item_split")]
37 #[must_use]
38 pub fn split(&mut self, text: &str, split_index: i32) -> Option<GlyphItem> {
39 unsafe {
40 from_glib_full(ffi::pango_glyph_item_split(
41 self.to_glib_none_mut().0,
42 text.to_glib_none().0,
43 split_index,
44 ))
45 }
46 }
47}