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