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
use crate::{GlyphItem, GlyphString, Item};
use glib::translate::*;
impl GlyphItem {
pub fn item(&self) -> Item {
unsafe { from_glib_none((*self.to_glib_none().0).item) }
}
pub fn glyph_string(&self) -> GlyphString {
unsafe { from_glib_none((*self.to_glib_none().0).glyphs) }
}
#[doc(alias = "pango_glyph_item_get_logical_widths")]
#[doc(alias = "get_logical_widths")]
pub fn logical_widths(&self, text: &str) -> Vec<i32> {
let count = text.chars().count();
unsafe {
let mut logical_widths = Vec::with_capacity(count);
ffi::pango_glyph_item_get_logical_widths(
mut_override(self.to_glib_none().0),
text.to_glib_none().0,
logical_widths.as_mut_ptr(),
);
logical_widths.set_len(count);
logical_widths
}
}
}